From 2b03b8c07c1e816af6627547b34711135483c5a2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 25 Dec 2015 17:47:19 +0100 Subject: 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) --- src/stream.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/stream.c') 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), -- cgit v1.2.3