com php-src: Fixed bug #72849 - integer overflow in urlencode: ext/standard/url.c

From: Date: Wed, 17 Aug 2016 05:55:42 +0000
Subject: com php-src: Fixed bug #72849 - integer overflow in urlencode: ext/standard/url.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93818@lists.php.net to get a copy of this message
Commit: b9e81e58440b9b5c07bf5435baef5531b2b318a0 Author: Stanislav Malyshev <stas@php.net> Tue, 16 Aug 2016 15:58:05 -0700 Parents: 24d741d376905ab21eed17c25dd3ce09a8893f80 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b9e81e58440b9b5c07bf5435baef5531b2b318a0 Log: Fixed bug #72849 - integer overflow in urlencode Bugs: https://bugs.php.net/72849 Changed paths: M ext/standard/url.c Diff: diff --git a/ext/standard/url.c b/ext/standard/url.c index 4b52000..8e471e1 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -520,6 +520,12 @@ PHPAPI char *php_url_encode(char const *s, int len, int *new_length) *to++ = c; } } + + if ((to-start) > INT_MAX) { + /* E_ERROR since most clients won't check for error, and this is rather rare condition */ + php_error_docref(NULL TSRMLS_CC, E_ERROR, "String overflow, max length is %d", INT_MAX); + } + *to = 0; if (new_length) { *new_length = to - start;

« previous php.cvs (#93818) next »