49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# check-overflow - check that zzuf catches buffer overflows
|
|
# Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net>
|
|
# All Rights Reserved
|
|
#
|
|
# This program is free software. It comes without any warranty, to
|
|
# the extent permitted by applicable law. You can redistribute it
|
|
# and/or modify it under the terms of the Do What The Fuck You Want
|
|
# To Public License, Version 2, as published by Sam Hocevar. See
|
|
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
#
|
|
|
|
. "$(dirname "$0")/functions.inc"
|
|
|
|
ulimit -c 0
|
|
|
|
PROGRAM="$DIR/bug-overflow"
|
|
if [ ! -f "$PROGRAM" ]; then
|
|
echo "error: test/bug-overflow is missing"
|
|
exit 1
|
|
fi
|
|
|
|
start_test "zzuf buffer overflow test"
|
|
|
|
new_test "bug-overflow < /file-00"
|
|
if ! $PROGRAM < "$DIR/file-00"; then
|
|
fail_test " unexpected exit status $?"
|
|
else
|
|
pass_test " OK"
|
|
fi
|
|
|
|
new_test "zzuf -qi -r0 bug-overflow < /file-00"
|
|
if ! $ZZUF -r0 -qi "$PROGRAM" < "$DIR/file-00"; then
|
|
fail_test " unexpected exit status $?"
|
|
else
|
|
pass_test " OK"
|
|
fi
|
|
|
|
new_test "zzuf -qi bug-overflow < file-00"
|
|
if $ZZUF -qi "$PROGRAM" < "$DIR/file-00"; then
|
|
fail_test " unexpected exit status $?"
|
|
else
|
|
pass_test " OK"
|
|
fi
|
|
|
|
stop_test
|
|
|