path: root/mailinfo.c
diff options
authorJeff King <>2020-02-11 17:19:53 (GMT)
committerJunio C Hamano <>2020-02-11 18:20:42 (GMT)
commitffbea1816dcbce12d4ffb304ddf8993ef611d4f1 (patch)
tree1f4f5f1bbf325e617985e3a693ae3d88332f9108 /mailinfo.c
parentf447d0293e803d9acf390bbdf373ed98bdc125f4 (diff)
mailinfo: be more liberal with header whitespace
RFC822 and friends allow arbitrary whitespace after the colon of a header and before the values. I.e.: Subject:foo Subject: foo Subject: foo all have the subject "foo". But mailinfo requires exactly one space. This doesn't seem to be bothering anybody, but it is pickier than the standard specifies. And we can easily just soak up arbitrary whitespace there in our parser, so let's do so. Note that the test covers both too little and too much whitespace, but the "too much" case already works fine (because we later eat leading and trailing whitespace from the values). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'mailinfo.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/mailinfo.c b/mailinfo.c
index ee8d05e..78f06da 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -351,9 +351,10 @@ static inline int skip_header(const struct strbuf *line, const char *hdr,
const char *val;
if (!skip_iprefix(line->buf, hdr, &val) ||
- *val++ != ':' ||
- !isspace(*val++))
+ *val++ != ':')
return 0;
+ while (isspace(*val))
+ val++;
*outval = val;
return 1;