| 272 | } |
| 273 | |
| 274 | static cJSON_bool decode_array_index_from_pointer(const unsigned char * const pointer, size_t * const index) |
| 275 | { |
| 276 | size_t parsed_index = 0; |
| 277 | size_t position = 0; |
| 278 | |
| 279 | if ((pointer[0] == '0') && ((pointer[1] != '\0') && (pointer[1] != '/'))) |
| 280 | { |
| 281 | /* leading zeroes are not permitted */ |
| 282 | return 0; |
| 283 | } |
| 284 | |
| 285 | for (position = 0; (pointer[position] >= '0') && (pointer[position] <= '9'); position++) |
| 286 | { |
| 287 | parsed_index = (10 * parsed_index) + (size_t)(pointer[position] - '0'); |
| 288 | |
| 289 | } |
| 290 | |
| 291 | if ((pointer[position] != '\0') && (pointer[position] != '/')) |
| 292 | { |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | *index = parsed_index; |
| 297 | |
| 298 | return 1; |
| 299 | } |
| 300 | |
| 301 | static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive) |
| 302 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…