From: Guus Sliepen Date: Thu, 26 Sep 2019 20:01:24 +0000 (+0200) Subject: Fix winerror() returning a pointer to a stack-allocated array. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=1cb5c08f6294db9d86fa2a887c730f90e150d4ae;p=meshlink Fix winerror() returning a pointer to a stack-allocated array. Found by cppcheck. --- diff --git a/src/utils.c b/src/utils.c index 94052d3d..6e1c4ccb 100644 --- a/src/utils.c +++ b/src/utils.c @@ -178,7 +178,7 @@ int b64encode_urlsafe(const void *src, char *dst, int length) { #endif const char *winerror(int err) { - char buf[1024], *ptr; + static char buf[1024], *ptr; ptr = buf + sprintf(buf, "(%d) ", err);