Merge branch 'rs/mailinfo-qp-decode-fix' into maint
"git mailinfo" was loose in decoding quoted printable and produced garbage when the two letters after the equal sign are not hexadecimal. This has been fixed. * rs/mailinfo-qp-decode-fix: mailinfo: don't decode invalid =XY quoted-printable sequences
This commit is contained in:
commit
01ae81e028
11
mailinfo.c
11
mailinfo.c
@ -368,11 +368,16 @@ static struct strbuf *decode_q_segment(const struct strbuf *q_seg, int rfc2047)
|
|||||||
|
|
||||||
while ((c = *in++) != 0) {
|
while ((c = *in++) != 0) {
|
||||||
if (c == '=') {
|
if (c == '=') {
|
||||||
int d = *in++;
|
int ch, d = *in;
|
||||||
if (d == '\n' || !d)
|
if (d == '\n' || !d)
|
||||||
break; /* drop trailing newline */
|
break; /* drop trailing newline */
|
||||||
strbuf_addch(out, (hexval(d) << 4) | hexval(*in++));
|
ch = hex2chr(in);
|
||||||
continue;
|
if (ch >= 0) {
|
||||||
|
strbuf_addch(out, ch);
|
||||||
|
in += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* garbage -- fall through */
|
||||||
}
|
}
|
||||||
if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */
|
if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */
|
||||||
c = 0x20;
|
c = 0x20;
|
||||||
|
Loading…
Reference in New Issue
Block a user