Possibly wrong assignment in config.c
- From
- Andrea 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