summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-06-02 01:00:40 +0000
committerngie <ngie@FreeBSD.org>2017-06-02 01:00:40 +0000
commitc00d83f65d3c23a8ef65a816388d8ad63136ba7f (patch)
tree96777f78bc88772e12281fbc354030fc6745f299 /contrib/netbsd-tests/lib
parent0f7d99025d479f6996524d85d6c9544bac630c9d (diff)
downloadFreeBSD-src-c00d83f65d3c23a8ef65a816388d8ad63136ba7f.zip
FreeBSD-src-c00d83f65d3c23a8ef65a816388d8ad63136ba7f.tar.gz
MFC r318210,r318211:
Approved by: re (gjb) r318210: ssp_test:read:: query the value of MAXPATHLEN via getconf(1) In the event the value of PATH_MAX was changed, the assumption that MAXPATHLEN is 1024 (and hence the buffer length required to trigger SSP to fail for read(2)) would be invalidated. Query getconf(1) for the actual value of MAXPATHLEN via _XOPEN_PATH_MAX instead, and increment the value by 1 to ensure that the SSP support tests the stack smashing support properly. r318211: Fix up previous commit - Apply the logic to the FreeBSD block - Fix a typo with the getconf(1) call that I would have caught, were it not for the fact that I got the blocks wrong. - Consolidate the hardcoded buffer sizes to the NetBSD block. This would have been discovered had I run the test on a system where PATH_MAX != 1024 (I don't have that at my disposal right at this moment). MFC with: r318210
Diffstat (limited to 'contrib/netbsd-tests/lib')
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/ssp/t_ssp.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh b/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh
index e535e3e..7b963d1 100755
--- a/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh
+++ b/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh
@@ -386,12 +386,14 @@ read_body()
{
prog="$(atf_get_srcdir)/h_read"
- h_pass "$prog 1024" "echo foo |"
# Begin FreeBSD
if true; then
- h_fail "$prog 1027" "echo bar |"
+ MAX_PATH=$(getconf _XOPEN_PATH_MAX) || atf_fail "getconf failed"
+ h_pass "$prog $MAX_PATH" "echo foo |"
+ h_fail "$prog $(( $MAX_PATH + 3 ))" "echo bar |"
else
# End FreeBSD
+ h_pass "$prog 1024" "echo foo |"
h_fail "$prog 1025" "echo bar |"
# Begin FreeBSD
fi
OpenPOWER on IntegriCloud