From: Stanislav Malyshev Date: Fri, 8 Sep 2000 13:19:51 +0000 (+0000) Subject: Don't trust snprintf return X-Git-Tag: php-4.0.3RC1~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d10336ec0e00baed0e5157db45d9eb597065bb47;p=php Don't trust snprintf return --- diff --git a/Zend/zend.c b/Zend/zend.c index 3ba958f11a..8e706b2481 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -615,6 +615,9 @@ ZEND_API void zend_error(int type, const char *format, ...) #ifdef HAVE_VSNPRINTF z_error_message->value.str.len = vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args); + if(z_error_message->value.str.len > ZEND_ERROR_BUFFER_SIZE-1) { + z_error_message->value.str.len = ZEND_ERROR_BUFFER_SIZE-1; + } #else /* This is risky... */ z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args);