libidn/libidn-CVE-2017-14062.patch

34 lines
1.2 KiB
Diff

Index: libidn-1.28/lib/punycode.c
===================================================================
--- libidn-1.28.orig/lib/punycode.c
+++ libidn-1.28/lib/punycode.c
@@ -89,11 +89,11 @@ enum
/* point (for use in representing integers) in the range 0 to */
/* base-1, or base if cp does not represent a value. */
-static punycode_uint
-decode_digit (punycode_uint cp)
+static unsigned
+decode_digit (int cp)
{
- return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
- cp - 97 < 26 ? cp - 97 : base;
+ return (unsigned) (cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
+ cp - 97 < 26 ? cp - 97 : base);
}
/* encode_digit(d,flag) returns the basic code point whose value */
Index: libidn-1.28/tests/tst_idna.c
===================================================================
--- libidn-1.28.orig/tests/tst_idna.c
+++ libidn-1.28/tests/tst_idna.c
@@ -211,7 +211,7 @@ static const struct idna idna[] = {
'x', 'n', '-', '-', 'f', 'o', 0x3067},
IDNA_ACE_PREFIX "too long too long too long too long too long too "
"long too long too long too long too long ", 0,
- IDNA_CONTAINS_ACE_PREFIX, IDNA_PUNYCODE_ERROR}
+ IDNA_CONTAINS_ACE_PREFIX, IDNA_INVALID_LENGTH}
};
void