numam-spdk/lib/json
Daniel Verkamp b33e0caf90 json: fix spdk_json_decode_array() bounds check
The spdk_json_decode_array() function previously tried to check whether
the array would fit into the provided number of output elements
(max_size) before decoding; however, the check was incorrectly comparing
the total number of nested JSON values in the array rather than just the
count of top-level array elements.

Rather than doing the check up front (which can't be done without
modifying the way array lengths are stored in spdk_json_value), just
check if we have reached the end of the 'out' array on each iteration of
the decoding loop.

Fixes GitHub issue #232.

Change-Id: I4d7ce4be022bdf5f726654d0d96277b9d63bd350
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/397591
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-01-31 14:37:00 -05:00
..
json_parse.c json_internal.h: rename to utf.h and place in spdk_internal 2018-01-11 10:57:38 -05:00
json_util.c json: fix spdk_json_decode_array() bounds check 2018-01-31 14:37:00 -05:00
json_write.c json_internal.h: rename to utf.h and place in spdk_internal 2018-01-11 10:57:38 -05:00
Makefile build: include spdk.common.mk in lib Makefiles 2016-07-18 16:17:40 -07:00