Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/mailinfo-qp-decode-fix'
author
Junio C Hamano
<gitster@pobox.com>
Thu, 28 Sep 2017 05:47:55 +0000
(14:47 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 28 Sep 2017 05:47:56 +0000
(14:47 +0900)
"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
mailinfo.c
patch
|
blob
|
history
raw
(from parent 1:
1ba75ff
)
diff --git
a/mailinfo.c
b/mailinfo.c
index bcdbf98de57878a55c732e17b8baeb933f3cc056..a89db22ab0c8ef50ae31d5811de5fc48d09224a2 100644
(file)
--- a/
mailinfo.c
+++ b/
mailinfo.c
@@
-367,11
+367,16
@@
static struct strbuf *decode_q_segment(const struct strbuf *q_seg, int rfc2047)
while ((c = *in++) != 0) {
if (c == '=') {
- int
d = *in++
;
+ int
ch, d = *in
;
if (d == '\n' || !d)
break; /* drop trailing newline */
- strbuf_addch(out, (hexval(d) << 4) | hexval(*in++));
- continue;
+ ch = hex2chr(in);
+ if (ch >= 0) {
+ strbuf_addch(out, ch);
+ in += 2;
+ continue;
+ }
+ /* garbage -- fall through */
}
if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */
c = 0x20;