stream.c: ensure to zero-initialize sctp_sndrcvinfo

caught by valgrind:
==3150== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
==3150==    at 0x60DC0D0: __sendmsg_nocancel (syscall-template.S:81)
==3150==    by 0x5DF3413: sctp_send (in /usr/lib/x86_64-linux-gnu/libsctp.so.1.0.16)
==3150==    by 0x65AA066: osmo_stream_srv_write (stream.c:540)
This commit is contained in:
Harald Welte 2015-12-25 17:47:19 +01:00
parent cc4ce39fc6
commit 2b03b8c07c
1 changed files with 2 additions and 0 deletions

View File

@ -129,6 +129,7 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
switch (cli->proto) {
#ifdef HAVE_LIBSCTP
case IPPROTO_SCTP:
memset(&sinfo, 0, sizeof(sinfo));
sinfo.sinfo_ppid = htonl(msgb_sctp_ppid(msg));
sinfo.sinfo_stream = htonl(msgb_sctp_stream(msg));
ret = sctp_send(cli->ofd.fd, msg->data, msgb_length(msg),
@ -535,6 +536,7 @@ static void osmo_stream_srv_write(struct osmo_stream_srv *conn)
switch (conn->srv->proto) {
#ifdef HAVE_LIBSCTP
case IPPROTO_SCTP:
memset(&sinfo, 0, sizeof(sinfo));
sinfo.sinfo_ppid = htonl(msgb_sctp_ppid(msg));
sinfo.sinfo_stream = htonl(msgb_sctp_stream(msg));
ret = sctp_send(conn->ofd.fd, msg->data, msgb_length(msg),