OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../uclibc/uClibc-0.9.31-dnslookup-use-after-free.patch
  5. # Copyright (C) 2010 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From eb1d8c8289f466ba3ad10b9a88ab2e426b8a9dc7 Mon Sep 17 00:00:00 2001
  17. From: Gabor Juhos <juhosg@openwrt.org>
  18. Date: Tue, 6 Apr 2010 09:55:19 +0200
  19. Subject: [PATCH] Fix use-after-free bug in __dns_lookup
  20. If the type of the first answer does not match with the requested type,
  21. then the dotted name was freed. If there are no further answers in
  22. the DNS reply, this pointer was used later on in the same function.
  23. Additionally it is passed to the caller, and caused strange
  24. behaviour.
  25. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  26. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
  27. ---
  28. libc/inet/resolv.c | 4 +---
  29. 1 files changed, 1 insertions(+), 3 deletions(-)
  30. diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
  31. index 056539f..9459199 100644
  32. --- a/libc/inet/resolv.c
  33. +++ b/libc/inet/resolv.c
  34. @@ -1517,10 +1517,8 @@ int attribute_hidden __dns_lookup(const char *name,
  35. memcpy(a, &ma, sizeof(ma));
  36. if (a->atype != T_SIG && (NULL == a->buf || (type != T_A && type != T_AAAA)))
  37. break;
  38. - if (a->atype != type) {
  39. - free(a->dotted);
  40. + if (a->atype != type)
  41. continue;
  42. - }
  43. a->add_count = h.ancount - j - 1;
  44. if ((a->rdlength + sizeof(struct in_addr*)) * a->add_count > a->buflen)
  45. break;
  46. --
  47. 1.7.0