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

Conrad Meyer cem at FreeBSD.org
Wed Mar 29 21:31:46 UTC 2017


Author: cem
Date: Wed Mar 29 21:31:45 2017
New Revision: 316181
URL: https://svnweb.freebsd.org/changeset/base/316181

Log:
  t_msgctl: Fix the same msgsnd() misuse as t_msgsnd
  
  msgsnd(2)'s msgsz argument does not describe the full structure, only the
  message component.
  
  Reported by:	Coverity
  CIDs:		1368703, 1368711
  Sponsored by:	Dell EMC Isilon

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

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c	Wed Mar 29 21:29:21 2017	(r316180)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c	Wed Mar 29 21:31:45 2017	(r316181)
@@ -203,7 +203,7 @@ ATF_TC_BODY(msgctl_pid, tc)
 
 	if (pid == 0) {
 
-		(void)msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT);
+		(void)msgsnd(id, &msg, sizeof(msg.buf), IPC_NOWAIT);
 
 		_exit(EXIT_SUCCESS);
 	}
@@ -314,7 +314,7 @@ ATF_TC_BODY(msgctl_time, tc)
 	t = time(NULL);
 
 	(void)memset(&msgds, 0, sizeof(struct msqid_ds));
-	(void)msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT);
+	(void)msgsnd(id, &msg, sizeof(msg.buf), IPC_NOWAIT);
 	(void)msgctl(id, IPC_STAT, &msgds);
 
 	if (llabs(t - msgds.msg_stime) > 1)


More information about the svn-src-all mailing list