Improve validation of JSON inputs

This commit is contained in:
Nik Bougalis
2014-03-06 21:15:55 -08:00
parent 242494a9ad
commit 4b71673ee9
6 changed files with 82 additions and 93 deletions

View File

@@ -383,8 +383,12 @@ bool STParsedJSON::parse (std::string const& json_name,
try
{
data.push_back (new STVariableLength (field,
strUnHex (value.asString ())));
std::pair<Blob, bool> ret(strUnHex (value.asString ()));
if (!ret.second)
throw std::invalid_argument ("invalid data");
data.push_back (new STVariableLength (field, ret.first));
}
catch (...)
{