summaryrefslogtreecommitdiffstats
path: root/main/wine/dn_skipname.patch
blob: 99ecf83158eeab2376fbf1ff5f9ef229eea6ce56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- ./dlls/dnsapi/ns_parse.c.orig
+++ ./dlls/dnsapi/ns_parse.c
@@ -69,6 +69,35 @@
 } while (0)
 
 /* Public. */
+#ifdef __UCLIBC__
+int
+dn_skipname(const u_char *comp_dn, const u_char *eom)
+{
+       const u_char *cp;
+       int n;
+
+       cp = comp_dn;
+       while (cp < eom && (n = *cp++)) {
+               /*
+                * check for indirection
+                */
+               switch (n & INDIR_MASK) {
+               case 0:                 /* normal case, n == len */
+                       cp += n;
+                       continue;
+               case INDIR_MASK:        /* indirection */
+                       cp++;
+                       break;
+               default:                /* illegal type */
+                       return (-1);
+               }
+               break;
+       }
+       if (cp > eom)
+               return (-1);
+       return (cp - comp_dn);
+}
+#endif
 
 static int
 dns_ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {