Browse files

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

git-svn-id: https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk@244 1f120ed1-78a5-a849-adca-83f0a9e25bb6
  • Loading branch information...
1 parent 802f775 commit 6962ce20df2cf103fdbff51ae6692ae4c23b8476 christopherdunn committed with rjeczalik Jun 22, 2011
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/lib_json/json_writer.cpp
View
2 src/lib_json/json_writer.cpp
@@ -119,6 +119,8 @@ std::string valueToString( bool value )
std::string valueToQuotedString( const char *value )
{
+ if (value == NULL)
+ return "";
// Not sure how to handle unicode...
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
return std::string("\"") + value + "\"";

0 comments on commit 6962ce2

Please sign in to comment.