Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jun 1998 19:09:24 -0400 (EDT)
From:      Mikhail Teterin <mi@video-collage.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/7059: sh dumps core on this script
Message-ID:  <199806242309.TAA09928@xxx.video-collage.com>

next in thread | raw e-mail | index | archive | help

>Number:         7059
>Category:       bin
>Synopsis:       sh dumps core on this script
>Confidential:   yes
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 24 16:10:01 PDT 1998
>Last-Modified:
>Originator:     Mikhail Teterin
>Organization:
Video Collage, Inc.
>Release:        FreeBSD 2.2.6-BETA i386
>Environment:

	QUERY_STRING=First_Name=Mikhail&Last_Name=Teterin&Phone=617-332-0552&Fax=&Email=mi%40aldan.algebra.com&Company=%26ls&Division=&Title=&Company_Size=less+than+25&Address=&City=&State=&Postal_Code=&Country=&Reference=Softimage+Website&Intended_Use=&Number_Users=single&Programming=Yes&B2=Submit&QQQLINKQQQ=./dura
	<------ start of mail.cgi script --------------->
#!/bin/sh

SETTINGS_DIR=`eval basename \`basename $0\``

# Do the mailing.
EMAILS_TXT=$SETTINGS_DIR/e-mails.txt

# If the file with addresses exist --
# use it. Otherwise, use hardcoded address.
if [ -r $EMAILS_TXT ]
then
	EMAILS=`egrep -v ^# $EMAILS_TXT`
else
	EMAILS=mi
fi

(env ; cat) | mail -s $0 $EMAILS

# Output the ThankYou text:
# First, look for the hidden field:
for pair in `echo ${QUERY_STRING} | sed 's/&/ /g'` ; do
	_TY_FILE=${pair#QQQLINKQQQ=}
	if [ $_TY_FILE != $pair ]
	then
		_TY_FILE=${DOCUMENT_ROOT}${_TY_FILE}
		test -r ${_TY_FILE} || \
			logger "${_TY_FILE} does not exist or is not readable"
		break
	fi
done

TY_FILE=${_TY_FILE:-$SETTINGS_DIR/ThankYou.html}

# This will tell the user's browser it will receive HTML
cat << BEGIN_HTML
Content-Type: text/html

BEGIN_HTML

# If the custom ThankYou.html exists -- output it,
# otherwise, output the build-in default message:
if [ -r $TY_FILE ]
then
	cat $TY_FILE
else
	cat << EO_TY
<HTML>
<HEAD>
<TITLE>Thank you</TITLE>
</HEAD>
<BODY>
<H1>Thank you for contacting us.</H1>
The information you submitted was forwarded for
processing.
<HR>
<img SRC="/vclogo.gif" ALT="Video Collage" ALIGN="RIGHT" WIDTH="182" HEIGHT="146
>Description:

	When the script is ran (with or without -x) it dies with seg-fault.
	This happens after processing the Email-part of QUERY_STRING . It
	started happending after I added the line with logger to it, although
	I can not see a relation. The script's checksum is
		473ad5b1e55577acf5ff70190e270894
	After rebuilding sh for debugging I find:

	0xc667 in popstackmark (mark=0xefbfd690) at memalloc.c:188
	188                     stackp = sp->prev;
	(gdb) p sp
	$1 = (struct stack_block *) 0x0

	My memalloc.c is
		$Id: memalloc.c,v 1.4.2.1 1997/08/25 09:10:08 jkh Exp $

>How-To-Repeat:

	setenv QUERY_STRING as set above
	sh -x ./mail.cgi

>Fix:
	
	Don't know... Do not want to use bash for this, although it works
	with no problems...
>Audit-Trail:
>Unformatted:
">
</BODY>
</HTML>
EO_TY
fi
	<----------- End of mail.cgi ------------->


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806242309.TAA09928>