Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2017 21:31:45 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316181 - head/contrib/netbsd-tests/lib/libc/sys
Message-ID:  <201703292131.v2TLVjBr090190@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703292131.v2TLVjBr090190>