Subject: Possibly wrong assignment in config.c

From: Andrea Monaco <[email-masked]>
Date: Wed, 13 Oct 2021 19:05:26 +0200

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