From c70e307e772c199de7a279fc098ea7e32d19afff Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 20 Sep 2007 21:55:14 +0000 Subject: fix potential overflow (Mattias Bengtsson) --- ext/iconv/iconv.c | 4 ++-- 1 file 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; } -- cgit v1.2.1