Fix record insertion
We were not making enough room. We want to move everything from the
place where we are going to insert the new record.
This was not causing failures because the code does not look at the
content after the inserted record, because it correctly returns an error
when seeing the inserted record. But as a matter on principle, the test
code should be doing what it says: just insert a new record but leave
a valid fragment after it.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function
index 8964adc..11648a3 100644
--- a/tests/suites/test_suite_ssl.function
+++ b/tests/suites/test_suite_ssl.function
@@ -243,14 +243,14 @@
TEST_LE_U(buf->content_length + 2 * header_length + inserted_content_length,
buf->capacity);
- /* Make room for an empty record and a record header */
+ /* Make room for the inserted record and a record header for the fragment */
size_t inserted_record_start = header_length + offset;
size_t inserted_content_start = inserted_record_start + header_length;
size_t tail_record_start = inserted_content_start + inserted_content_length;
size_t tail_content_start = tail_record_start + header_length;
memmove(buf->buffer + tail_content_start,
- buf->buffer + tail_record_start,
- buf->content_length - tail_record_start);
+ buf->buffer + inserted_record_start,
+ buf->content_length - inserted_record_start);
buf->content_length += 2 * header_length;
/* Construct the inserted record based on the existing one */