summaryrefslogtreecommitdiffstats
path: root/x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch')
-rw-r--r--x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch b/x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch
new file mode 100644
index 0000000000..a7a2c93b40
--- /dev/null
+++ b/x11-libs/wine/patches/0001-dnsapi-Work-around-missing-ns_name_skip.patch
@@ -0,0 +1,92 @@
+From 930a2109f1d11f1c0571b869faea94d228440f7b Mon Sep 17 00:00:00 2001
+From: Hans Leidekker <hans@meelstraat.net>
+Date: Sun, 10 Oct 2021 23:51:49 +0200
+Subject: [PATCH 1/2] dnsapi: Work around missing ns_name_skip
+
+On some non-glibc systems (specifically musl) ns_name_skip may be missing.
+
+Fixes: 0d26dd2afbc3 ("dnsapi: Get rid of imported domain name parsing code.")
+[ismael@iodev.co.uk: Edited commit message]
+Upstream-Status: Submitted [https://bugs.winehq.org/show_bug.cgi?id=50985]
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ dlls/dnsapi/libresolv.c | 35 +++++++++++++++++++++++++++++++----
+ 1 file changed, 31 insertions(+), 4 deletions(-)
+
+diff --git a/dlls/dnsapi/libresolv.c b/dlls/dnsapi/libresolv.c
+index 197ca84aeae9..032efb88a884 100644
+--- a/dlls/dnsapi/libresolv.c
++++ b/dlls/dnsapi/libresolv.c
+@@ -548,6 +548,33 @@ static unsigned int get_record_size( const ns_rr *rr )
+ return size;
+ }
+
++/* based on ns_name_skip from libresolv */
++static int skip_name( const unsigned char **ptr, const unsigned char *end )
++{
++ const unsigned char *cp = *ptr;
++ unsigned int len;
++
++ while (cp < end && (len = *cp++))
++ {
++ switch (len & NS_CMPRSFLGS)
++ {
++ case 0:
++ cp += len;
++ continue;
++ case NS_CMPRSFLGS:
++ cp++;
++ break;
++ default:
++ return -1;
++ }
++ break;
++ }
++
++ if (cp > end) return -1;
++ *ptr = cp;
++ return 0;
++}
++
+ static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD *dlen )
+ {
+ DNS_STATUS ret = ERROR_SUCCESS;
+@@ -594,7 +621,7 @@ static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD
+ r->Data.MINFO.pNameMailbox = dname_from_msg( msg, pos );
+ if (!r->Data.MINFO.pNameMailbox) return ERROR_NOT_ENOUGH_MEMORY;
+
+- if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
++ if (skip_name( &pos, ns_msg_end( msg ) ) < 0)
+ return DNS_ERROR_BAD_PACKET;
+
+ r->Data.MINFO.pNameErrorsMailbox = dname_from_msg( msg, pos );
+@@ -655,7 +682,7 @@ static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD
+ r->Data.SIG.pNameSigner = dname_from_msg( msg, pos );
+ if (!r->Data.SIG.pNameSigner) return ERROR_NOT_ENOUGH_MEMORY;
+
+- if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
++ if (skip_name( &pos, ns_msg_end( msg ) ) < 0)
+ return DNS_ERROR_BAD_PACKET;
+
+ /* FIXME: byte order? */
+@@ -680,7 +707,7 @@ static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD
+ r->Data.SOA.pNamePrimaryServer = dname_from_msg( msg, pos );
+ if (!r->Data.SOA.pNamePrimaryServer) return ERROR_NOT_ENOUGH_MEMORY;
+
+- if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
++ if (skip_name( &pos, ns_msg_end( msg ) ) < 0)
+ return DNS_ERROR_BAD_PACKET;
+
+ r->Data.SOA.pNameAdministrator = dname_from_msg( msg, pos );
+@@ -690,7 +717,7 @@ static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD
+ return ERROR_NOT_ENOUGH_MEMORY;
+ }
+
+- if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
++ if (skip_name( &pos, ns_msg_end( msg ) ) < 0)
+ return DNS_ERROR_BAD_PACKET;
+
+ r->Data.SOA.dwSerialNo = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
+--
+2.33.0
+