fix rejection of dns responses with pointers past 512 byte offset
[musl] / src / network / hstrerror.c
index b7a6ab6..a4d001c 100644 (file)
@@ -1,5 +1,6 @@
 #define _GNU_SOURCE
 #include <netdb.h>
+#include "locale_impl.h"
 
 static const char msgs[] =
        "Host not found\0"
@@ -12,5 +13,6 @@ const char *hstrerror(int ecode)
 {
        const char *s;
        for (s=msgs, ecode--; ecode && *s; ecode--, s++) for (; *s; s++);
-       return *s ? s : s+1;
+       if (!*s) s++;
+       return LCTRANS_CUR(s);
 }