getservbyport_r: fix out-of-bounds buffer read
[musl] / src / errno / __errno_location.c
index a018578..7f9d602 100644 (file)
@@ -1,9 +1,9 @@
 #include <errno.h>
-#include "libc.h"
+#include "pthread_impl.h"
 
 int *__errno_location(void)
 {
-       static int e;
-       if (libc.errno_location) return libc.errno_location();
-       return &e;
+       return &__pthread_self()->errno_val;
 }
+
+weak_alias(__errno_location, ___errno_location);