bug#2407932: strpbrk() could fail for NULL pointer.

This commit is contained in:
Christopher Dunn 2011-06-22 21:04:41 +00:00
parent 9d317c3794
commit 3b3540d9ef

View File

@ -119,6 +119,8 @@ std::string valueToString( bool value )
std::string valueToQuotedString( const char *value ) std::string valueToQuotedString( const char *value )
{ {
if (value == NULL)
return "";
// Not sure how to handle unicode... // Not sure how to handle unicode...
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
return std::string("\"") + value + "\""; return std::string("\"") + value + "\"";