svn commit: r316179 - head/contrib/netbsd-tests/lib/libc/sys

Conrad Meyer cem at FreeBSD.org
Wed Mar 29 21:27:30 UTC 2017


Author: cem
Date: Wed Mar 29 21:26:13 2017
New Revision: 316179
URL: https://svnweb.freebsd.org/changeset/base/316179

Log:
  t_msgsnd: Use msgsnd()'s msgsz argument correctly to avoid overflow
  
  msgsnd's msgsz argument is the size of the message following the 'long'
  message type.  Don't include the message type in the size of the message
  when invoking msgsnd(2).
  
  Reported by:	Coverity
  CID:		1368712
  Sponsored by:	Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c	Wed Mar 29 21:04:39 2017	(r316178)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c	Wed Mar 29 21:26:13 2017	(r316179)
@@ -234,7 +234,7 @@ ATF_TC_BODY(msgsnd_nonblock, tc)
 		for (;;) {
 
 			errno = 0;
-			rv = msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT);
+			rv = msgsnd(id, &msg, sizeof(msg.buf), IPC_NOWAIT);
 
 			if (rv == -1 && errno == EAGAIN)
 				_exit(EXIT_SUCCESS);


More information about the svn-src-all mailing list