summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2017-08-01 11:16:47 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2017-08-01 11:16:47 +0200
commit3284eb342cd0ed1a18786e3fcdf0cdd7e76676bd (patch)
tree660d6557143e68c324acd12bebecca7b44e83d6d
parent16853b6973a1e72fee2b7cccda85472cb9951305 (diff)
downloadlibidn2-3284eb342cd0ed1a18786e3fcdf0cdd7e76676bd.tar.gz
lib/puny_decode: Fix integer overflow (found by fuzzing)
-rw-r--r--lib/puny_decode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/puny_decode.c b/lib/puny_decode.c
index 3a1dd4f..7fb5305 100644
--- a/lib/puny_decode.c
+++ b/lib/puny_decode.c
@@ -93,10 +93,10 @@ enum { base = 36, tmin = 1, tmax = 26, skew = 38, damp = 700,
/* 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);
}
/*** Platform-specific constants ***/