void-packages/srcpkgs/wine/patches/musl-ns_name_skip.patch

49 lines
1.0 KiB
Diff

diff --git a/dlls/dnsapi/libresolv.c b/dlls/dnsapi/libresolv.c
index ac52147..0f8c2ef 100644
--- wine-6.9/dlls/dnsapi/libresolv.c
+++ wine-6.9/dlls/dnsapi/libresolv.c
@@ -57,6 +57,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
+/* code from glibc's resolv/ns_name.c, with errno setting removed */
+/*%
+ * Advance *ptrptr to skip over the compressed name it points at.
+ *
+ * return:
+ *\li 0 on success, -1 (with errno set) on failure.
+ */
+#ifndef __GLIBC__
+static int
+ns_name_skip(const u_char **ptrptr, const u_char *eom)
+{
+ const u_char *cp;
+ u_int n;
+
+ cp = *ptrptr;
+ while (cp < eom && (n = *cp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /*%< normal case, n == len */
+ cp += n;
+ continue;
+ case NS_CMPRSFLGS: /*%< indirection */
+ cp++;
+ break;
+ default: /*%< illegal type */
+ return (-1);
+ }
+ break;
+ }
+ if (cp > eom) {
+ return (-1);
+ }
+ *ptrptr = cp;
+ return (0);
+}
+#endif
+
static const char *debugstr_type( unsigned short type )
{
const char *str;