Date: Sun, 7 Jul 2002 22:36:49 +0200 (CEST) From: Cyrille Lefevre <cyrille.lefevre@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/40314: mail is unable to parse From line w/o email address Message-ID: <200207072036.g67KancY080316@gits.gits.dyndns.org>
next in thread | raw e-mail | index | archive | help
>Number: 40314
>Category: bin
>Synopsis: mail is unable to parse From line w/o email address
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Jul 07 13:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Cyrille Lefevre
>Release: FreeBSD 4.6-STABLE i386
>Organization:
ACME
>Environment:
System: FreeBSD gits 4.6-STABLE FreeBSD 4.6-STABLE #15: Sun Jun 23 06:31:23 CEST 2002 root@gits:/disk2/freebsd/src/sys/compile/CUSTOM i386
>Description:
mail don't display messages w/ a badly formatted From line such as :
From Sun Jul 7 21:55:25 2002
^ no email address
the following patch try to parse the email address as a valid date
before the decide that's really an email address.
>How-To-Repeat:
cat << EOF > test.mbox
From Sun Jul 7 21:55:25 2002
From: root@gits.dyndns.org
Date: Sun, 07 Jul 2002 21:55:24 +0200 (CEST)
To: test@gits.dyndns.org
Precedence: bulk
wrong body
EOF
mail -f test.mbox
Mail version 8.1 6/6/93. Type ? for help.
"test.mbox": 0 messages
& q
# oops!
cat << EOF >> test.mbox
From root@gits.dyndns.org Sun Jul 7 21:55:25 2002
From: root@gits.dyndns.org
Subject: right message
Date: Sun, 07 Jul 2002 21:55:24 +0200 (CEST)
To: test@gits.dyndns.org
Precedence: bulk
right body
EOF
mail -f test.mbox
"test.mbox": 1 message 1 unread
>Fix:
Index: head.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/mail/head.c,v
retrieving revision 1.1.1.1.14.3
diff -u -r1.1.1.1.14.3 head.c
--- head.c 15 Mar 2002 19:46:31 -0000 1.1.1.1.14.3
+++ head.c 7 Jul 2002 20:20:30 -0000
@@ -113,12 +113,19 @@
* Skip over "From" first.
*/
cp = nextword(cp, word);
- cp = nextword(cp, word);
- if (*word != '\0')
- hl->l_from = copyin(word, &sp);
- if (cp != NULL && cp[0] == 't' && cp[1] == 't' && cp[2] == 'y') {
+ /*
+ * Illegal empty address.
+ */
+ if (isdate(cp))
+ hl->l_from = copyin("nobody", &sp);
+ else {
cp = nextword(cp, word);
- hl->l_tty = copyin(word, &sp);
+ if (*word != '\0')
+ hl->l_from = copyin(word, &sp);
+ if (cp != NULL && cp[0] == 't' && cp[1] == 't' && cp[2] == 'y') {
+ cp = nextword(cp, word);
+ hl->l_tty = copyin(word, &sp);
+ }
}
if (cp != NULL)
hl->l_date = copyin(cp, &sp);
>Release-Note:
>Audit-Trail:
>Unformatted:
1 root@gits.dyndns.org Sun Jul 7 21:55 10/211 "right message"
& d1
& q
"test.mbox" removed
# oops!
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?200207072036.g67KancY080316>
