]> git.meshlink.io Git - meshlink/commitdiff
Fix winerror() returning a pointer to a stack-allocated array.
authorGuus Sliepen <guus@meshlink.io>
Thu, 26 Sep 2019 20:01:24 +0000 (22:01 +0200)
committerGuus Sliepen <guus@meshlink.io>
Thu, 26 Sep 2019 20:01:24 +0000 (22:01 +0200)
Found by cppcheck.

src/utils.c

index 94052d3d02d6986329b3295734b975c7a33bff25..6e1c4ccb27bc98d017bb6d751791b9ce5514fe74 100644 (file)
@@ -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);