Skip to content

Commit 5db7fc0

Browse files
authored
Merge pull request #8940 from rizlik/dtls_fix_record_span_tests
fix(tests): enlarge readBuf in DTLS record tests
2 parents 6c8ab11 + ae9ba66 commit 5db7fc0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/api/test_dtls.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ int test_dtls_record_cross_boundaries(void)
11011101
WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
11021102
WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
11031103
struct test_memio_ctx test_ctx;
1104-
unsigned char readBuf[100];
1104+
unsigned char readBuf[256];
11051105
int rec0_len, rec1_len;
11061106

11071107
XMEMSET(&test_ctx, 0, sizeof(test_ctx));
@@ -1124,7 +1124,8 @@ int test_dtls_record_cross_boundaries(void)
11241124
rec1_len = test_ctx.s_msg_sizes[1];
11251125

11261126
ExpectIntLE(rec0_len + rec1_len, sizeof(readBuf));
1127-
XMEMCPY(readBuf, test_ctx.s_buff, rec0_len + rec1_len);
1127+
if (EXPECT_SUCCESS())
1128+
XMEMCPY(readBuf, test_ctx.s_buff, rec0_len + rec1_len);
11281129

11291130
/* clear buffer */
11301131
test_memio_clear_buffer(&test_ctx, 0);
@@ -1247,7 +1248,7 @@ int test_records_span_network_boundaries(void)
12471248
WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
12481249
WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
12491250
struct test_memio_ctx test_ctx;
1250-
unsigned char readBuf[50];
1251+
unsigned char readBuf[256];
12511252
int record_len;
12521253

12531254
XMEMSET(&test_ctx, 0, sizeof(test_ctx));
@@ -1263,10 +1264,11 @@ int test_records_span_network_boundaries(void)
12631264
/* create a good record in the buffer */
12641265
wolfSSL_SetLoggingPrefix("client");
12651266
ExpectIntEQ(wolfSSL_write(ssl_c, "test", 4), 4);
1266-
ExpectIntLE(test_ctx.s_len, 50);
1267+
ExpectIntLE(test_ctx.s_len, sizeof(readBuf));
12671268
ExpectIntGT(test_ctx.s_len, 10);
12681269
record_len = test_ctx.s_len;
1269-
XMEMCPY(readBuf, test_ctx.s_buff, record_len);
1270+
if (EXPECT_SUCCESS())
1271+
XMEMCPY(readBuf, test_ctx.s_buff, record_len);
12701272

12711273
/* drop record and simulate a split write */
12721274
ExpectIntEQ(test_memio_drop_message(&test_ctx, 0, 0), 0);

0 commit comments

Comments
 (0)