From: Phillip Wood Date: Thu, 21 Jul 2022 14:17:43 GMT Subject: Re: [PATCH] compat/win32: correct for incorrect compiler warning Message-ID: <653c6a24-df30-2b06-4cf7-f01bd6012d55@gmail.com> In-Reply-To: Hi Stolee > diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c > index 1f8d8934cc9..0af18d88825 100644 > --- a/compat/win32/syslog.c > +++ b/compat/win32/syslog.c > @@ -44,6 +44,7 @@ void syslog(int priority, const char *fmt, ...) > > while ((pos = strstr(str, "%1")) != NULL) { > size_t offset = pos - str; > + char *new_pos; > char *oldstr = str; > str = realloc(str, st_add(++str_len, 1)); Not related to your patch but this context line looks suspicious as str_len is incremented without checking for overflow. I did wonder if it should be using a post increment instead and was using the st_add() to check if that overflowed but str_len is an int so we'd still have undefined behavior. Best Wishes Phillip