Handle NULL strings in vprintf_callback(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-02-18 15:43:08 +01:00
parent 564f99b3ae
commit e8cfd5bf85
1 changed files with 3 additions and 0 deletions

View File

@ -411,6 +411,9 @@ size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t),
else
goto incomprehensible_conversion;
if ( conversion == 's' && !string )
string = "(null)";
size_t string_length = 0;
for ( size_t i = 0; i < precision && string[i]; i++ )
string_length++;