diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-06-01 05:10:35 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-01 05:10:35 +0300 |
commit | db5b7c3e462a327e07c451d8a6e41b2ba193a1f8 (patch) | |
tree | bbfbff91730463c853b0e2338ca127a3ff8e7f81 /compat/win32 | |
parent | 1bcf4f6271ad8c952739164d160e97efd579424f (diff) | |
parent | 2acf4cf0010379f10b39eba1fb4e0868a5ba4114 (diff) |
Merge branch 'js/ci-gcc-12-fixes'
Fixes real problems noticed by gcc 12 and works around false
positives.
* js/ci-gcc-12-fixes:
dir.c: avoid "exceeds maximum object size" error with GCC v12.x
nedmalloc: avoid new compile error
compat/win32/syslog: fix use-after-realloc
Diffstat (limited to 'compat/win32')
-rw-r--r-- | compat/win32/syslog.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c index 161978d720..1f8d8934cc 100644 --- a/compat/win32/syslog.c +++ b/compat/win32/syslog.c @@ -43,6 +43,7 @@ void syslog(int priority, const char *fmt, ...) va_end(ap); while ((pos = strstr(str, "%1")) != NULL) { + size_t offset = pos - str; char *oldstr = str; str = realloc(str, st_add(++str_len, 1)); if (!str) { @@ -50,6 +51,7 @@ void syslog(int priority, const char *fmt, ...) warning_errno("realloc failed"); return; } + pos = str + offset; memmove(pos + 2, pos + 1, strlen(pos)); pos[1] = ' '; } |