Re: [PATCH] apply: use strcmp(3) for comparing strings in gitdiff_verify_name()
- Date: Sat, 08 Jul 2017 15:38:55 +0200
- From: Andreas Schwab <schwab@xxxxxxxxxxxxxx>
- Subject: Re: [PATCH] apply: use strcmp(3) for comparing strings in gitdiff_verify_name()
On Jul 08 2017, René Scharfe <l.s.r@xxxxxx> wrote:
> Am 08.07.2017 um 13:08 schrieb Andreas Schwab:
>> On Jul 08 2017, René Scharfe <l.s.r@xxxxxx> wrote:
>>> Avoid running over the end of another -- a C string whose length we
>>> don't know -- by using strcmp(3) instead of memcmp(3) for comparing it
>>> with another C string.
>> That's not a good justification for the change, since memcmp never reads
>> past the differing characters.
> Interesting. Where does that guarantee come from?
Sorry, I misremembered. It's only memchr that has this restriction.
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."