]> git.ipfire.org Git - thirdparty/git.git/commit - mailinfo.c
mailinfo: treat header values as C strings
authorJeff King <peff@peff.net>
Tue, 11 Feb 2020 17:18:52 +0000 (12:18 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Feb 2020 18:17:16 +0000 (10:17 -0800)
commitb6537d83ee30693efb17a35321b8bd03b752033a
treed38e40bd1f8d2478a3b1f5cc9af6917840d9becc
parent517b60564e2c69cbb79895e04b24a6393273398f
mailinfo: treat header values as C strings

We read each header line into a strbuf, which means that we could
in theory handle header values with embedded NUL bytes. But in practice,
the values we parse out are passed to decode_header(), which uses
strstr(), strchr(), etc. And we would not expect such bytes anyway; they
are forbidden by RFC822, etc. and any non-ASCII characters should be
encoded with RFC2047 encoding.

So let's switch to using strbuf_addstr(), which saves us some length
computations (and will enable further cleanups in this code).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mailinfo.c