git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] apply: use strcmp(3) for comparing strings in gitdiff_verify_name()

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 8, 2017, 22:29 UTC
Message-ID
<xmqqo9sua7gz.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<8bd7c4c6-c545-723b-ec4b-262abd8a7f5f@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 13 quoted lines
> Am 08.07.2017 um 13:08 schrieb Ramsay Jones:
>> On 08/07/17 09:58, René Scharfe 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.
>>
>> I had to read this twice, along with the patch text, before this
>> made any sense. ;-) The missing information being that 'another'
>> was the name of the string variable that we were potentially
>> 'running over the end of'.
>
> Yeah, sorry, encasing that unusual variable name in quotes would
> probably have helped.

What makes it even more confusing is that the variable with the problematic name is referred to as "it" in the last part of the description--- the second occurrence of 'another' is actually not referring to that variable but yet another string that is being compared with it ;-)

Previous: René ScharfeNext: René Scharfe
Message 11 of 12 in “apply: use strcmp(3) for comparing strings in gitdiff_verify_name()”
  1. apply: use strcmp(3) for comparing strings in gitdiff_verify_name()René Scharfe, Jul 8, 2017
  2. Andreas SchwabJul 8, 2017
  3. René ScharfeJul 8, 2017
  4. Andreas SchwabJul 8, 2017
  5. René ScharfeJul 9, 2017
  6. Andreas SchwabJul 9, 2017
  7. René ScharfeJul 9, 2017
  8. Junio C HamanoJul 9, 2017
  9. Ramsay JonesJul 8, 2017
  10. René ScharfeJul 8, 2017
  11. Junio C HamanoJul 8, 2017
  12. René ScharfeJul 9, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.