mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 19:04:05 +00:00
Fix invalid read reported by valgrind
This commit is contained in:
parent
c4d8df27bc
commit
f2696fa412
@ -1220,7 +1220,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
|
||||
}
|
||||
|
||||
/* If we are here, there is at least a section line */
|
||||
if (*(cfg->reader.buffer.ptr + cfg->reader.buffer.size - 1) != '\n')
|
||||
if (cfg->reader.buffer.size > 0 && *(cfg->reader.buffer.ptr + cfg->reader.buffer.size - 1) != '\n')
|
||||
git_filebuf_write(&file, "\n", 1);
|
||||
|
||||
git_filebuf_printf(&file, "\t%s = %s\n", name, value);
|
||||
|
Loading…
Reference in New Issue
Block a user