;
if (q[0] != '?' || !strchr ("BbQq", q[1]) || q[2] != '?')
continue;
- for (q = q + 3; 0x20 < *q && *q < 0x7f && *q != '?'; q++)
+ /* non-strict check since many MUAs will not encode spaces and question marks */
+ for (q = q + 3; 0x20 <= *q && *q < 0x7f && (*q != '?' || q[1] != '='); q++)
;
if (q[0] != '?' || q[1] != '=')
{
}
if (rfc2047_decode_word (d, p, dlen) < 0)
- strcpy(d, p);
+ {
+ n = q - p;
+ if (n > dlen)
+ n = dlen;
+ memcpy (d, p, n);
+ }
found_encoded = 1;
s = q;
n = strlen (d);