summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2007-09-20 21:55:14 +0000
committerStanislav Malyshev <stas@php.net>2007-09-20 21:55:14 +0000
commitc70e307e772c199de7a279fc098ea7e32d19afff (patch)
tree7a4fbab2b69b06f5adee1564fa00c133834a4c07 /ext/iconv
parentcfd8f6d775587c55e6537ce9c34c737242180cd6 (diff)
downloadphp-git-c70e307e772c199de7a279fc098ea7e32d19afff.tar.gz
fix potential overflow (Mattias Bengtsson)
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 2c69068802..52b95e186d 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -700,11 +700,11 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
}
}
- if (offset >= total_len) {
+ if (offset >= total_len || len > total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
- if ((offset + len) > total_len) {
+ if ((offset + len) > total_len ) {
/* trying to compute the length */
len = total_len - offset;
}