Debian Codegraph @

tests/namazu-cgi-9

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # Test for buffer overflow
4 #
5 LOG=`pwdscip-shell system . . pwd.`/test-log
6 echoscip-shell system . . echo. ' *** starting ' $0 >>$LOG
7 . ${srcdir}/commonfuncs
8 pwd=`pwdscip-shell system . . pwd.`
9 tmprc="$pwd/../src/.namazurc"
10 echoscip-shell system . . echo. "Index $pwd/idx19" > $tmprc
11 duprcs
12
13 # To make messages English
14 unset LANG; export LANG
15 LANGUAGE=C; export LANGUAGE
16 LC_ALL=C; export LC_ALL
17 unset LC_MESSAGES; export LC_MESSAGES
18 unset LC_CTYPE; export LC_CTYPE
19
20 SCRIPT_NAME='namazu.cgi'
21 export SCRIPT_NAME
22
23 # long cgi paramater (should be chopped by QUERY_MAX)
24 QUERY_STRING='query='`perlscip-shell system . . perl. -e 'print "x" x 2048'`
25 export QUERY_STRING
26 cd ../src
27
28 RESULTS=`./namazu.cgi 2>> $LOG | grepscip-shell system . . grep. -i 'too long' | wcscip-shell system . . wc. -l`
29 testscip-shell system . . test. $RESULTS -ne 1 && exit 1
30
31 QUERY_STRING='query=+'`perlscip-shell system . . perl. -e 'print "x" x 2048'`':foobar'
32 export QUERY_STRING
33 RESULTS=`./namazu.cgi 2>> $LOG | grepscip-shell system . . grep. -i 'too long' | wcscip-shell system . . wc. -l`
34 testscip-shell system . . test. $RESULTS -ne 1 && exit 1
35
36 QUERY_STRING='query=/'`perlscip-shell system . . perl. -e 'print "x" x 2048'`'/'
37 export QUERY_STRING
38 RESULTS=`./namazu.cgi 2>> $LOG | grepscip-shell system . . grep. -i 'too long' | wcscip-shell system . . wc. -l`
39 testscip-shell system . . test. $RESULTS -ne 1 && exit 1
40
41 # long SCRIPT_NAME environment variable
42 QUERY_STRING='query=namazu'
43 export QUERY_STRING
44 SCRIPT_NAME='namazu-l'`perlscip-shell system . . perl. -e 'print "o" x 2048'`'ng.cgi'
45 export SCRIPT_NAME
46 ./namazu.cgi >> $LOG 2>&1
47 testscip-shell system . . test. $? -ne 0 && exit 1
48
49 # long HOME environment variable
50 HOME='/home/l'`perlscip-shell system . . perl. -e 'print "o" x 2048'`'ong-dir'
51 export HOME
52 envscip-shell system . . env. NAMAZUNORC='SYSCONFIG' ./namazu.cgi >> $LOG 2>&1
53 testscip-shell system . . test. $? -ne 0 && exit 1
54
55 # long LANG environment variable
56 LANG='ja_JP.eucJP-l'`perlscip-shell system . . perl. -e 'print "o" x 2048'`'ong' >> $LOG 2>&1
57 export LANG >> $LOG 2>&1
58 ./namazu.cgi >> $LOG 2>&1
59 testscip-shell system . . test. $? -ne 0 && exit 1
60
61 exit 0