$OpenBSD: patch-lib_punycode_c,v 1.1 2017/10/20 20:26:53 jca Exp $

Fix for CVE-2017-14062

commit 3284eb342cd0ed1a18786e3fcdf0cdd7e76676bd
Author: Tim Rühsen <tim.ruehsen@gmx.de>
Date:   Tue Aug 1 11:16:47 2017 +0200

    lib/puny_decode: Fix integer overflow (found by fuzzing)

Index: lib/punycode.c
--- lib/punycode.c.orig
+++ lib/punycode.c
@@ -94,10 +94,10 @@ enum { base = 36, tmin = 1, tmax = 26, skew = 38, damp
 /* 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      */
