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