mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 08:31:43 +02:00
#3136: Fixed null character issue when parsing a JSON
This commit is contained in:
@@ -204,7 +204,12 @@ void ParserImpl::handle()
|
||||
break;
|
||||
}
|
||||
case JSON_STRING:
|
||||
if (_pHandler) _pHandler->value(std::string(json_get_string(_pJSON, NULL)));
|
||||
if (_pHandler)
|
||||
{
|
||||
std::size_t length = 0;
|
||||
const char* val = json_get_string(_pJSON, &length);
|
||||
_pHandler->value(std::string(val, length == 0 ? 0 : length - 1)); // Decrease the length by 1 because it also contains the terminating null character
|
||||
}
|
||||
break;
|
||||
case JSON_OBJECT:
|
||||
if (_pHandler) _pHandler->startObject();
|
||||
|
Reference in New Issue
Block a user