0001-lib-punycode.c-decode_digit-Fix-integer-overflow.patch 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From e9e81b8063b095b02cf104bb992fa9bf9515b9d8 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
  3. Date: Fri, 1 Sep 2017 10:04:48 +0200
  4. Subject: [PATCH] lib/punycode.c (decode_digit): Fix integer overflow
  5. This fix is a backport from libidn2 and addresses
  6. CVE-2017-14062.
  7. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  8. ---
  9. Upstream status: commit e9e81b8063b095
  10. lib/punycode.c | 6 +++---
  11. 1 file changed, 3 insertions(+), 3 deletions(-)
  12. diff --git a/lib/punycode.c b/lib/punycode.c
  13. index 86819a7deb85..49250a13e2cc 100644
  14. --- a/lib/punycode.c
  15. +++ b/lib/punycode.c
  16. @@ -88,10 +88,10 @@ enum
  17. /* point (for use in representing integers) in the range 0 to */
  18. /* base-1, or base if cp does not represent a value. */
  19. -static punycode_uint
  20. -decode_digit (punycode_uint cp)
  21. +static unsigned
  22. +decode_digit (int cp)
  23. {
  24. - return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
  25. + return (unsigned) cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
  26. cp - 97 < 26 ? cp - 97 : base;
  27. }
  28. --
  29. 2.14.1