about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/network/dn_skipname.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/dn_skipname.c b/src/network/dn_skipname.c
new file mode 100644
index 00000000..d54c2e5d
--- /dev/null
+++ b/src/network/dn_skipname.c
@@ -0,0 +1,12 @@
+#include <resolv.h>
+
+int dn_skipname(const unsigned char *s, const unsigned char *end)
+{
+	const unsigned char *p;
+	for (p=s; p<end; p++)
+		if (!*p) return p-s+1;
+		else if (*p>=192)
+			if (p+1<end) return p-s+2;
+			else break;
+	return -1;
+}