summaryrefslogtreecommitdiff
path: root/ext/standard/php_smart_str.h
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-11-03 20:36:52 -0700
committerStanislav Malyshev <stas@php.net>2016-11-03 20:36:52 -0700
commitea9fac94bbae150a81fde0e6542e6b45965772cd (patch)
tree124f543734d75dd5aecd9743dbe4031b4bd244a9 /ext/standard/php_smart_str.h
parent6558559bcc1cd24e3639e4a215e9d546ee05fc48 (diff)
downloadphp-git-ea9fac94bbae150a81fde0e6542e6b45965772cd.tar.gz
More string length checks & fixes
Diffstat (limited to 'ext/standard/php_smart_str.h')
-rw-r--r--ext/standard/php_smart_str.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
index edd9d3a89f..a336660987 100644
--- a/ext/standard/php_smart_str.h
+++ b/ext/standard/php_smart_str.h
@@ -57,7 +57,8 @@
newlen = (n); \
(d)->a = newlen < SMART_STR_START_SIZE \
? SMART_STR_START_SIZE \
- : newlen + SMART_STR_PREALLOC; \
+ : (newlen >= (INT_MAX - SMART_STR_PREALLOC)? newlen \
+ : (newlen + INT_MAX)); \
SMART_STR_DO_REALLOC(d, what); \
} else { \
newlen = (d)->len + (n); \