Skip to content

Commit

Permalink
mailinfo: skip bogus UNIX From line inside body
Browse files Browse the repository at this point in the history
Sometimes people just include the whole format-patch output in
the commit e-mail.  Detect it and skip the bogus ">From " line.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed May 22, 2006
1 parent d5e3d60 commit 81c5cf7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mailinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,17 @@ static int eatspace(char *line)
#define SEEN_FROM 01
#define SEEN_DATE 02
#define SEEN_SUBJECT 04
#define SEEN_BOGUS_UNIX_FROM 010

/* First lines of body can have From:, Date:, and Subject: */
static int handle_inbody_header(int *seen, char *line)
{
if (!memcmp(">From", line, 5) && isspace(line[5])) {
if (!(*seen & SEEN_BOGUS_UNIX_FROM)) {
*seen |= SEEN_BOGUS_UNIX_FROM;
return 1;
}
}
if (!memcmp("From:", line, 5) && isspace(line[5])) {
if (!(*seen & SEEN_FROM) && handle_from(line+6)) {
*seen |= SEEN_FROM;
Expand Down

0 comments on commit 81c5cf7

Please sign in to comment.