tests/sctp: initialize addrlen for accept(2) properly
PATCH 1/1 tests/sctp: initialize addrlen for accept(2) properly
The 'addrlen' argument of accept(2) must point to a variable containing the size of the structure pointed to by 'addr'. In some cases it was being left unitialized. Fix this.
Signed-off-by Ondrej Mosnacek <[email protected]>
--- tests/sctp/sctp_asconf_params_server.c | 1 + tests/sctp/sctp_set_peer_addr.c | 1 + 2 files changed, 2 insertions(+)
tests/sctp/sctp_asconf_params_server.c +1 -0
@@ -112,6 +112,7 @@ int main(int argc, char **argv)fclose (f); } + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );
tests/sctp/sctp_set_peer_addr.c +1 -0
@@ -277,6 +277,7 @@ int main(int argc, char **argv)printf ("Client peer address count: %d\n" , peer_count);/* Client and server now set so accept new socket on server side. */ + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );
Signature · 1 line
2.23.0
Quoted 5 lines · Ondrej Mosnacek
The 'addrlen' argument of accept(2) must point to a variable containing the size of the structure pointed to by 'addr'. In some cases it was being left unitialized. Fix this.
Signed-off-by Ondrej Mosnacek <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Quoted 30 lines
--- tests/sctp/sctp_asconf_params_server.c | 1 + tests/sctp/sctp_set_peer_addr.c | 1 + 2 files changed, 2 insertions(+)tests/sctp/sctp_asconf_params_server.c +1
-0@@ -112,6 +112,7 @@ int main(int argc, char **argv)fclose (f); } + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );tests/sctp/sctp_set_peer_addr.c +1
-0@@ -277,6 +277,7 @@ int main(int argc, char **argv)printf ("Client peer address count: %d\n" , peer_count);/* Client and server now set so accept new socket on server side. */ + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );
Stephen Smalley
AppliedQuoted 5 lines · Ondrej Mosnacek
The 'addrlen' argument of accept(2) must point to a variable containing the size of the structure pointed to by 'addr'. In some cases it was being left unitialized. Fix this.
Signed-off-by Ondrej Mosnacek <[email protected]>
Thanks, applied.
Quoted 30 lines
--- tests/sctp/sctp_asconf_params_server.c | 1 + tests/sctp/sctp_set_peer_addr.c | 1 + 2 files changed, 2 insertions(+)tests/sctp/sctp_asconf_params_server.c +1
-0@@ -112,6 +112,7 @@ int main(int argc, char **argv)fclose (f); } + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );tests/sctp/sctp_set_peer_addr.c +1
-0@@ -277,6 +277,7 @@ int main(int argc, char **argv)printf ("Client peer address count: %d\n" , peer_count);/* Client and server now set so accept new socket on server side. */ + sinlen =sizeof (sin); new_sock =accept (srv_sock, (struct sockaddr *)&sin, &sinlen);if (new_sock <0 ) {perror ("accept" );