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

Possibly wrong assignment in config.c

From
AMAndrea Monaco <andrea.monaco@autistici.org>
Date
Oct 13, 2021, 17:05 UTC
Message-ID
<87pms8rh2h.fsf@autistici.org>
Hello,
while building git I get the following warning:
config.c: In function 'git_config_copy_or_rename_section_in_file':
config.c:3358:17: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 3358 |       output[0] = '\t';
      |       ~~~~~~~~~~^~~~~~
config.c:3264:7: note: at offset -1 to object 'buf' with size 1024 declared here
 3264 |  char buf[1024];
      |       ^~~
concerning these lines:
  output -= 1;
  output[0] = '\t';

Perhaps it has some merit. output is previously equal to an array buf[1024], so the assignment apparently goes outside allocated memory.

Let me know,
Andrea Monaco
Next: Junio C Hamano
Message 1 of 2 in “Possibly wrong assignment in config.c”
  1. Andrea MonacoOct 13, 2021
  2. Junio C HamanoOct 13, 2021

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.