Date: Wed, 27 Jun 2018 15:28:10 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335703 - head/tests/sys/audit Message-ID: <201806271528.w5RFSA7l025737@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Jun 27 15:28:09 2018 New Revision: 335703 URL: https://svnweb.freebsd.org/changeset/base/335703 Log: audit(4): fix Coverity issues Fix several incorrect buffer size arguments and a file descriptor leak. Submitted by: aniketp Reported by: Coverity CID: 1393489 1393501 1393509 1393510 1393514 1393515 1393516 CID: 1393517 1393518 1393519 MFC after: 2 weeks X-MFC-With: 335284 X-MFC-With: 335318 X-MFC-With: 335320 Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D16000 Modified: head/tests/sys/audit/administrative.c head/tests/sys/audit/file-attribute-access.c head/tests/sys/audit/file-attribute-modify.c Modified: head/tests/sys/audit/administrative.c ============================================================================== --- head/tests/sys/audit/administrative.c Wed Jun 27 14:45:13 2018 (r335702) +++ head/tests/sys/audit/administrative.c Wed Jun 27 15:28:09 2018 (r335703) @@ -163,7 +163,7 @@ ATF_TC_BODY(nfs_getfh_success, tc) snprintf(adregex, sizeof(adregex), "nfs_getfh.*%d.*ret.*success", pid); /* File needs to exist to call getfh(2) */ - ATF_REQUIRE(filedesc = open(path, O_CREAT, mode) != -1); + ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); FILE *pipefd = setup(fds, auclass); ATF_REQUIRE_EQ(0, getfh(path, &fhp)); check_audit(fds, adregex, pipefd); Modified: head/tests/sys/audit/file-attribute-access.c ============================================================================== --- head/tests/sys/audit/file-attribute-access.c Wed Jun 27 14:45:13 2018 (r335702) +++ head/tests/sys/audit/file-attribute-access.c Wed Jun 27 15:28:09 2018 (r335703) @@ -44,9 +44,9 @@ static pid_t pid; static fhandle_t fht; static int filedesc, fhdesc; static char extregex[80]; +static char buff[] = "ezio"; static struct stat statbuff; static struct statfs statfsbuff; -static const char *buff = "ezio"; static const char *auclass = "fa"; static const char *name = "authorname"; static const char *path = "fileforaudit"; Modified: head/tests/sys/audit/file-attribute-modify.c ============================================================================== --- head/tests/sys/audit/file-attribute-modify.c Wed Jun 27 14:45:13 2018 (r335702) +++ head/tests/sys/audit/file-attribute-modify.c Wed Jun 27 15:28:09 2018 (r335703) @@ -46,7 +46,7 @@ static int filedesc, retval; static struct pollfd fds[1]; static mode_t mode = 0777; static char extregex[80]; -static const char *buff = "ezio"; +static char buff[] = "ezio"; static const char *auclass = "fm"; static const char *name = "authorname"; static const char *path = "fileforaudit";
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806271528.w5RFSA7l025737>