mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Never trust snprintf return value
This commit is contained in:
parent
6426d1c9ce
commit
522aec4443
2 changed files with 6 additions and 0 deletions
|
@ -317,6 +317,9 @@ PHPAPI int php_printf(const char *format, ...)
|
|||
|
||||
va_start(args, format);
|
||||
size = vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
if(size > sizeof(buffer) - 1) {
|
||||
size = sizeof(buffer) - 1;
|
||||
}
|
||||
ret = PHPWRITE(buffer, size);
|
||||
va_end(args);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue