Skip to content

Commit

Permalink
main/musl: handle DNS responses with 64+ IP address records
Browse files Browse the repository at this point in the history
This was discussed on the #musl IRC channel. A legacy check returns
an error when more than 63 IP addresses are returned in a DNS
response. This patch removes that check & error.

Fixes #15320
  • Loading branch information
dermotbradley authored and ptrcnull committed Oct 6, 2023
1 parent 9000bc6 commit a22cf87
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main/musl/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.2.4_git20230717
pkgrel=2
pkgrel=3
pkgdesc="the musl c library (libc) implementation"
url="https://musl.libc.org/"
arch="all"
Expand All @@ -21,6 +21,7 @@ esac
_commit="83b858f83b658bd34eca5d8ad4d145f673ae7e5e"
source="musl-$_commit.tar.gz::https://git.musl-libc.org/cgit/musl/snapshot/$_commit.tar.gz
handle-aux-at_base.patch
remove-dns-63-records-limit.patch
ldconfig
__stack_chk_fail_local.c
Expand Down Expand Up @@ -155,4 +156,5 @@ a76f79b801497ad994746cf82bb6eaf86f9e1ae646e6819fbae8532a7f4eee53a96ac1d4e789ec8f
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
7f5b9d934d82deb5f8b23e16169a5d9b99ccab3a4708df06a95d685e1b24a3a3e69b3dcf4942f2f66c12a3d4bf0c5827e2ee2e8c4d7b1997359fccc2ac212dee getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c
088620aeeea1a407a103728f839d21c10c830820e1dae970edd70282534758d7fdb6d1d2d2761ccecac7a3e56ffb79c7b7085f3fe80a01d324d7bc0d94bb15f7 remove-dns-63-records-limit.patch
"
27 changes: 27 additions & 0 deletions main/musl/remove-dns-63-records-limit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Date: Wed, 4 Oct 2023 21:29:43 +0200
From: Quentin Rameau <quinq@fifth.space>
To: musl@lists.openwall.com
Subject: [PATCH] Remove arbitrary limit from NS resolution

The name resolution would abort when getting more than 63 records per
request, due to what seems to be a left-over from the original code.

Somehow reported by Daniel Stefanik[0].

[0] https://gitlab.alpinelinux.org/alpine/aports/-/issues/15320
---
src/network/dns_parse.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/src/network/dns_parse.c b/src/network/dns_parse.c
index ea1ec126..09813112 100644
--- a/src/network/dns_parse.c
+++ b/src/network/dns_parse.c
@@ -12,7 +12,6 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c
p = r+12;
qdcount = r[4]*256 + r[5];
ancount = r[6]*256 + r[7];
- if (qdcount+ancount > 64) return -1;
while (qdcount--) {
while (p-r < rlen && *p-1U < 127) p++;
if (p>r+rlen-6)

0 comments on commit a22cf87

Please sign in to comment.