Skip to content

Commit 199a547

Browse files
Merge pull request #7166 from miyazakh/gcc5_strict-aliasing
fix strict-aliasing rules warning on gcc 5.x
2 parents 478c063 + 00f4afb commit 199a547

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/api.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69194,6 +69194,8 @@ static int test_tls_multi_handshakes_one_record(void)
6919469194
struct test_memio_ctx test_ctx;
6919569195
WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
6919669196
WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
69197+
RecordLayerHeader* rh = NULL;
69198+
byte *len ;
6919769199
int newRecIdx = RECORD_HEADER_SZ;
6919869200
int idx = 0;
6919969201

@@ -69211,7 +69213,10 @@ static int test_tls_multi_handshakes_one_record(void)
6921169213
while (idx < test_ctx.c_len) {
6921269214
word16 recLen;
6921369215

69214-
ato16(((RecordLayerHeader*)(test_ctx.c_buff + idx))->length, &recLen);
69216+
rh = (RecordLayerHeader*)(test_ctx.c_buff + idx);
69217+
len = &rh->length[0];
69218+
69219+
ato16((const byte*)len, &recLen);
6921569220
idx += RECORD_HEADER_SZ;
6921669221

6921769222
XMEMMOVE(test_ctx.c_buff + newRecIdx, test_ctx.c_buff + idx,
@@ -69220,8 +69225,9 @@ static int test_tls_multi_handshakes_one_record(void)
6922069225
newRecIdx += recLen;
6922169226
idx += recLen;
6922269227
}
69223-
c16toa(newRecIdx - RECORD_HEADER_SZ,
69224-
((RecordLayerHeader*)test_ctx.c_buff)->length);
69228+
rh = (RecordLayerHeader*)(test_ctx.c_buff);
69229+
len = &rh->length[0];
69230+
c16toa(newRecIdx - RECORD_HEADER_SZ, len);
6922569231
test_ctx.c_len = newRecIdx;
6922669232

6922769233
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);

0 commit comments

Comments
 (0)