]>
Commit | Line | Data |
---|---|---|
b40388bb MT |
1 | --- cyrus-imapd-2.2.6/imap/message.c.acceptinvalidfrom 2004-10-30 15:03:02.220642392 -0700 |
2 | +++ cyrus-imapd-2.2.6/imap/message.c 2004-10-30 15:06:01.838336352 -0700 | |
3 | @@ -229,6 +229,8 @@ | |
4 | int reject8bit = config_getswitch(IMAPOPT_REJECT8BIT); | |
5 | int munge8bit = config_getswitch(IMAPOPT_MUNGE8BIT); | |
6 | int inheader = 1, blankline = 1; | |
7 | + char is_from; | |
8 | + static const char * from_header = "From "; | |
9 | ||
10 | while (size) { | |
11 | n = prot_read(from, buf, size > 4096 ? 4096 : size); | |
12 | @@ -294,8 +296,20 @@ | |
13 | /* Check for valid header name */ | |
14 | if (sawnl && buf[0] != ' ' && buf[0] != '\t') { | |
15 | if (buf[0] == ':') return IMAP_MESSAGE_BADHEADER; | |
16 | - for (p = (unsigned char *)buf; *p != ':'; p++) { | |
17 | - if (*p <= ' ') return IMAP_MESSAGE_BADHEADER; | |
18 | + p = (unsigned char *) buf; | |
19 | + if (*p == '>') | |
20 | + p++; | |
21 | + if (*p == from_header[0]) | |
22 | + is_from = 0; | |
23 | + else | |
24 | + is_from = -1; | |
25 | + for (; *p != ':' && is_from < 5; p++) { | |
26 | + if (is_from > 0 && *p != from_header[is_from]) | |
27 | + is_from = -1; | |
28 | + if (is_from >= 0) | |
29 | + is_from++; | |
30 | + else | |
31 | + if (*p <= ' ') return IMAP_MESSAGE_BADHEADER; | |
32 | } | |
33 | } | |
34 |