diff options
author | rrs <rrs@FreeBSD.org> | 2010-07-07 11:19:06 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2010-07-07 11:19:06 +0000 |
commit | 11ebe7c039dba8300e25b31bef6b05e09b75ac1e (patch) | |
tree | 7790171a7eef4cc47322052428d32f260eab31e9 /lib/libc | |
parent | 23a23d37250db03a1d20f0bb38bfa72d23201795 (diff) | |
download | FreeBSD-src-11ebe7c039dba8300e25b31bef6b05e09b75ac1e.zip FreeBSD-src-11ebe7c039dba8300e25b31bef6b05e09b75ac1e.tar.gz |
If a user calls sctp_sendx() with a NULL
sinfo we will crash. Instead we should provide
our own temp structure to use internally.
MFC after: 1 month
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/sctp_sys_calls.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index 1a20146..fcf4886 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -724,6 +724,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, struct sctp_sndrcvinfo *sinfo, int flags) { + struct sctp_sndrcvinfo __sinfo; ssize_t ret; int i, cnt, *aa, saved_errno; char *buf; @@ -790,6 +791,10 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, return (ret); } continue_send: + if (sinfo == NULL) { + sinfo = &__sinfo; + memset(&__sinfo, 0, sizeof(__sinfo)); + } sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { printf("Huh, can't get associd? TSNH!\n"); |