summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/network/dn_skipname.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/network/dn_skipname.c')
-rw-r--r--libc-top-half/musl/src/network/dn_skipname.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/network/dn_skipname.c b/libc-top-half/musl/src/network/dn_skipname.c
new file mode 100644
index 0000000..eba65bb
--- /dev/null
+++ b/libc-top-half/musl/src/network/dn_skipname.c
@@ -0,0 +1,15 @@
+#include <resolv.h>
+
+int dn_skipname(const unsigned char *s, const unsigned char *end)
+{
+ const unsigned char *p = s;
+ while (p < end)
+ if (!*p) return p-s+1;
+ else if (*p>=192)
+ if (p+1<end) return p-s+2;
+ else break;
+ else
+ if (end-p<*p+1) break;
+ else p += *p + 1;
+ return -1;
+}