diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-12-25 17:47:19 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-12-25 17:47:19 +0100 |
commit | 2b03b8c07c1e816af6627547b34711135483c5a2 (patch) | |
tree | f6fccfcd22557622fea9c5c401a1092ec2f2982d | |
parent | cc4ce39fc6e3b844605eb3fbc1c413b3282ed292 (diff) |
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)
-rw-r--r-- | src/stream.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c index d56224b..0736ba7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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), |