From: Eric Sunshine Date: Tue, 11 Feb 2020 17:26:58 GMT Subject: Re: [PATCH 1/4] mailinfo: treat header values as C strings Message-ID: In-Reply-To: <20200211171852.GA2119034@coredump.intra.peff.net> On Tue, Feb 11, 2020 at 12:18 PM Jeff King wrote: > 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 s/etc/etc./ > 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