com php-src: Fixed bug #72849 - integer overflow in urlencode: ext/standard/url.c
| From: | Ferenc Kovacs | Date: | Thu, 18 Aug 2016 10:53:39 +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-93943@lists.php.net to get a copy of this message | ||
Commit: dc223e524d640167c0f12e942eb52cabd6f89ee4
Author: Stanislav Malyshev <stas@php.net> Tue, 16 Aug 2016 15:58:05 -0700
Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 18 Aug 2016 12:53:39 +0200
Parents: 444314a2919587674c24777e56d29b4040b4fed4
Branches: PHP-5.6.25
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dc223e524d640167c0f12e942eb52cabd6f89ee4
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;