Recent gcc started tracking this and now it's warning: test_1_to_1_connectx.c: In function ‘main’: test_1_to_1_connectx.c:133:17: warning: array subscript ‘struct sockaddr[0]’ is partly outside array bounds of ‘unsigned char[15]’ [-Warray-bounds] 133 | tmp_addr->sa_family = AF_INET; | ^~ test_1_to_1_connectx.c:132:40: note: referencing an object of size 15 allocated by ‘malloc’ 132 | tmp_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr) - 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It gets parsed by __connectx_addrsize using each family struct, but they aligned to sockaddr size. So lets fix it here by allocating the right size. Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx> --- src/func_tests/test_1_to_1_connectx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/func_tests/test_1_to_1_connectx.c b/src/func_tests/test_1_to_1_connectx.c index 3cb18b3aad421720e8598e9a0bbab2de987d4467..9adab2352c09d0fb0087e4c4b43c6d7d7b60de0d 100644 --- a/src/func_tests/test_1_to_1_connectx.c +++ b/src/func_tests/test_1_to_1_connectx.c @@ -129,7 +129,7 @@ main(int argc, char *argv[]) tst_resm(TPASS, "sctp_connectx() with invalid socket - ENOTSOCK"); /*sctp_connectx () TEST3: Invalid address, EINVAL Expected error*/ - tmp_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr) - 1); + tmp_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr)); tmp_addr->sa_family = AF_INET; error = sctp_connectx(sk, tmp_addr, 1, NULL); if (error != -1 || errno != EINVAL) -- 2.30.2