blob: eba65bb82ad277a15662084e570c6fd6046b0f1f [file] [log] [blame]
Rich Felkerb6f99412013-04-04 22:36:30 -04001#include <resolv.h>
2
3int dn_skipname(const unsigned char *s, const unsigned char *end)
4{
Ryan Fairfax2a0ff452019-03-07 13:20:54 -08005 const unsigned char *p = s;
6 while (p < end)
Rich Felkerb6f99412013-04-04 22:36:30 -04007 if (!*p) return p-s+1;
8 else if (*p>=192)
9 if (p+1<end) return p-s+2;
10 else break;
Ryan Fairfax2a0ff452019-03-07 13:20:54 -080011 else
12 if (end-p<*p+1) break;
13 else p += *p + 1;
Rich Felkerb6f99412013-04-04 22:36:30 -040014 return -1;
15}