Skip to content

Commit

Permalink
t_msgctl: Fix the same msgsnd() misuse as t_msgsnd
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cemeyer committed Mar 29, 2017
1 parent 1a663d3 commit 70aca7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 70aca7c

Please sign in to comment.