Merge branch 'jk/pack-idx-corruption-safety'
[gitweb.git] / compat / win32 / syslog.c
index d015e436d57472bf9560a6f604705f52938c9f19..b905aea31bf53dc0f614d5e95c0dbd382818cbc4 100644 (file)
@@ -32,7 +32,7 @@ void syslog(int priority, const char *fmt, ...)
                return;
        }
 
-       str = malloc(str_len + 1);
+       str = malloc(st_add(str_len, 1));
        if (!str) {
                warning("malloc failed: '%s'", strerror(errno));
                return;
@@ -43,7 +43,7 @@ void syslog(int priority, const char *fmt, ...)
        va_end(ap);
 
        while ((pos = strstr(str, "%1")) != NULL) {
-               str = realloc(str, ++str_len + 1);
+               str = realloc(str, st_add(++str_len, 1));
                if (!str) {
                        warning("realloc failed: '%s'", strerror(errno));
                        return;