Set ETHEREAL_ABORT_ON_DISSECTOR_BUG. Make sure we create a core file. Fix

up file names and extensions.

svn path=/trunk/; revision=16190
This commit is contained in:
Gerald Combs 2005-10-11 15:17:06 +00:00
parent 1cfe020e5b
commit 25d75e66a7
1 changed files with 17 additions and 10 deletions

View File

@ -17,9 +17,11 @@ CAPINFOS=./capinfos
# This needs to point to a 'date' that supports %s.
DATE=/bin/date
# Where our temp files are saved (editcap.out and stderr.out)
# Temporary file directory and names.
# (had problems with this on cygwin, tried TMP_DIR=./ which worked)
TMP_DIR=/tmp
TMP_FILE=fuzz-test.pcap
ERR_FILE=fuzz-err.txt
# These may be set to your liking
# Stop the child process, if it's running longer than x seconds
@ -28,10 +30,14 @@ MAX_CPU_TIME=900
MAX_VMEM=500000
# Insert z times an error into the capture file (0.02 seems to be a good value to find errors)
ERR_PROB=0.02
# Trigger an abort if a dissector finds a bug.
# Uncomment to disable
ETHEREAL_ABORT_ON_DISSECTOR_BUG="True"
# set some limits to the child processes, e.g. stop it if it's running longer then MAX_CPU_TIME seconds
# (ulimit is not supported well on cygwin and probably other platforms, e.g. cygwin shows some warnings)
ulimit -S -t $MAX_CPU_TIME -v $MAX_VMEM
ulimit -c unlimited
### usually you won't have to change anything below this line ###
@ -89,29 +95,30 @@ while [ 1 ] ; do
DISSECTOR_BUG=0
"$EDITCAP" -E $ERR_PROB "$CF" $TMP_DIR/editcap.out > /dev/null 2>&1
"$EDITCAP" -E $ERR_PROB "$CF" $TMP_DIR/$TMP_FILE > /dev/null 2>&1
if [ $? -ne 0 ] ; then
"$EDITCAP" -E $ERR_PROB -T ether "$CF" $TMP_DIR/editcap.out > /dev/null 2>&1
"$EDITCAP" -E $ERR_PROB -T ether "$CF" $TMP_DIR/$TMP_FILE \
> /dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "Invalid format for editcap"
continue
fi
fi
"$TETHEREAL" $TETHEREAL_ARGS $TMP_DIR/editcap.out \
> /dev/null 2> $TMP_DIR/stderr.out
"$TETHEREAL" $TETHEREAL_ARGS $TMP_DIR/$TMP_FILE \
> /dev/null 2> $TMP_DIR/$ERR_FILE
RETVAL=$?
grep -i "dissector bug" $TMP_DIR/stderr.out \
grep -i "dissector bug" $TMP_DIR/$ERR_FILE \
> /dev/null 2>&1 && DISSECTOR_BUG=1
if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then
SUF=`$DATE +%s`
FUZZ_FILE="fuzz-`$DATE +%Y-%m-%d`-$$.pcap"
echo " ERROR"
echo -e "Processing failed. Capture info follows:\n"
mv $TMP_DIR/editcap.out $TMP_DIR/editcap.out.$SUF
echo " Output file: $TMP_DIR/editcap.out.$SUF"
mv $TMP_DIR/$TMP_FILE $TMP_DIR/$FUZZ_FILE
echo " Output file: $TMP_DIR/$FUZZ_FILE"
if [ $DISSECTOR_BUG -ne 0 ] ; then
echo -e "stderr follows:\n"
cat $TMP_DIR/stderr.out
cat $TMP_DIR/$ERR_FILE
fi
exit 1
fi