logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0006-dns-fix-nameserver-OOB-read-in-IPv6-disabled-fallbac.patch (1176B)


  1. From df97e1c57780588639d8f6aff7dd8f1db8b63c19 Mon Sep 17 00:00:00 2001
  2. From: Liam Wachter <liam@asymmetric.re>
  3. Date: Fri, 20 Mar 2026 12:19:40 -0400
  4. Subject: [PATCH] dns: fix nameserver OOB read in IPv6-disabled fallback
  5. In __res_msend_rc(), the IPv6-disabled fallback check uses conf->ns[nns]
  6. inside a loop controlled by i, so it tests a fixed slot instead of
  7. walking configured nameservers. This reads one past the array's size.
  8. Use conf->ns[i] so the loop correctly detects whether all configured
  9. nameservers are IPv6-only.
  10. ---
  11. src/network/res_msend.c | 2 +-
  12. 1 file changed, 1 insertion(+), 1 deletion(-)
  13. diff --git a/src/network/res_msend.c b/src/network/res_msend.c
  14. index fcb52513..51d42ecb 100644
  15. --- a/src/network/res_msend.c
  16. +++ b/src/network/res_msend.c
  17. @@ -124,7 +124,7 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
  18. /* Handle case where system lacks IPv6 support */
  19. if (fd < 0 && family == AF_INET6 && errno == EAFNOSUPPORT) {
  20. - for (i=0; i<nns && conf->ns[nns].family == AF_INET6; i++);
  21. + for (i=0; i<nns && conf->ns[i].family == AF_INET6; i++);
  22. if (i==nns) {
  23. pthread_setcancelstate(cs, 0);
  24. return -1;
  25. --
  26. 2.49.0