From owner-svn-src-head@freebsd.org Wed Mar 29 21:27:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4823BD24C10; Wed, 29 Mar 2017 21:27:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AF52A82; Wed, 29 Mar 2017 21:27:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2TLQE5M087163; Wed, 29 Mar 2017 21:26:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2TLQEhP087162; Wed, 29 Mar 2017 21:26:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201703292126.v2TLQEhP087162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 29 Mar 2017 21:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316179 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2017 21:27:30 -0000 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);