[dpdk-dev] [PATCH v3 5/8] examples/power: add json string handling
Burakov, Anatoly
anatoly.burakov at intel.com
Tue Sep 25 17:31:12 CEST 2018
On 25-Sep-18 4:15 PM, Hunt, David wrote:
>>>> What happens if someone sends a string with a "{" or "}" inside?
>>>>
>>>
>>> If we get to the end of the buffer without a "}", it calls the
>>> library to convert, will fail, and move on. No damage done (I hope).
>>> Also, a short un-terminated (by "}") string will also exit when no
>>> characters read.
>>> So any invalid JSON string that's send to Jansson will fail to parse,
>>> and the application will be ready for the next (hopefully valid) JSON
>>> string.
>>
>> No, what i meant is something like this:
>>
>> { "json_value": "{"}
>>
>> According to JSON validator, this is a valid JSON string, but it will
>> break your code :)
>>
>
> You are correct if this code was designed to be a general purpose JSON
> string reader. However, it's only designed to take in strings for this
> sample application, and they do not expect any brace characters embedded
> within quotes. So I think it's OK for this use case. Patches welcome,
> though! :)
>
Fair enough :)
> Thanks,
> Dave.
>
>
>
--
Thanks,
Anatoly
More information about the dev
mailing list