Date: Tue, 29 Jan 2019 17:52:42 +0000 (UTC) From: Kristof Provost <kp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343555 - stable/12/tests/sys/netpfil/pf/ioctl Message-ID: <201901291752.x0THqg9t022709@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kp Date: Tue Jan 29 17:52:42 2019 New Revision: 343555 URL: https://svnweb.freebsd.org/changeset/base/343555 Log: MFC r343297: pf tests: Check size validation in DIOCGETSRCNODES Ensure that invalid sizes for DIOCGETSRCNODES do not cause panics. Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c ============================================================================== --- stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Jan 29 17:49:39 2019 (r343554) +++ stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Jan 29 17:52:42 2019 (r343555) @@ -753,6 +753,38 @@ ATF_TC_CLEANUP(commit, tc) COMMON_CLEANUP(); } +ATF_TC_WITH_CLEANUP(getsrcnodes); +ATF_TC_HEAD(getsrcnodes, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(getsrcnodes, tc) +{ + struct pfioc_src_nodes psn; + + COMMON_HEAD(); + + bzero(&psn, sizeof(psn)); + + psn.psn_len = -1; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size -1 failed"); + + psn.psn_len = 1 << 30; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size << 30 failed"); + + psn.psn_len = 1 << 31; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size << 30 failed"); +} + +ATF_TC_CLEANUP(getsrcnodes, tc) +{ + COMMON_CLEANUP(); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, addtables); @@ -772,6 +804,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, cxbegin); ATF_TP_ADD_TC(tp, cxrollback); ATF_TP_ADD_TC(tp, commit); + ATF_TP_ADD_TC(tp, getsrcnodes); return (atf_no_error()); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901291752.x0THqg9t022709>