com php-src: Fix bug #72850 - integer overflow in uuencode: ext/standard/uuencode.c

From: Date: Thu, 18 Aug 2016 10:53:47 +0000
Subject: com php-src: Fix bug #72850 - integer overflow in uuencode: ext/standard/uuencode.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93939@lists.php.net to get a copy of this message
Commit: c35e4cb20cdeb02d9d362c57edce11c2948effcd Author: Stanislav Malyshev <stas@php.net> Tue, 16 Aug 2016 16:03:44 -0700 Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 18 Aug 2016 12:53:47 +0200 Parents: dc223e524d640167c0f12e942eb52cabd6f89ee4 Branches: PHP-5.6.25 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c35e4cb20cdeb02d9d362c57edce11c2948effcd Log: Fix bug #72850 - integer overflow in uuencode Bugs: https://bugs.php.net/72850 Changed paths: M ext/standard/uuencode.c Diff: diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index cd35c28..a31f14d 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -153,7 +153,7 @@ PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ while (s < ee) { if(s+4 > e) { goto err; - } + } *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); @@ -188,7 +188,7 @@ err: } /* }}} */ -/* {{{ proto string convert_uuencode(string data) +/* {{{ proto string convert_uuencode(string data) uuencode a string */ PHP_FUNCTION(convert_uuencode) { @@ -200,6 +200,11 @@ PHP_FUNCTION(convert_uuencode) } dst_len = php_uuencode(src, src_len, &dst); + if (dst_len < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "String too long, max length is %d", INT_MAX); + efree(dst); + RETURN_FALSE; + } RETURN_STRINGL(dst, dst_len, 0); }

« previous php.cvs (#93939) next »