svn commit: r209760 - head/lib/libc/net

Randall Stewart rrs at FreeBSD.org
Wed Jul 7 11:19:07 UTC 2010


Author: rrs
Date: Wed Jul  7 11:19:06 2010
New Revision: 209760
URL: http://svn.freebsd.org/changeset/base/209760

Log:
  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

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==============================================================================
--- head/lib/libc/net/sctp_sys_calls.c	Wed Jul  7 10:55:13 2010	(r209759)
+++ head/lib/libc/net/sctp_sys_calls.c	Wed Jul  7 11:19:06 2010	(r209760)
@@ -724,6 +724,7 @@ sctp_sendx(int sd, const void *msg, size
     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
 		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");


More information about the svn-src-all mailing list