mirror of
https://github.com/json-c/json-c.git
synced 2026-11-06 21:50:17 +08:00
reject empty reference token as array index in json_pointer
This commit is contained in:
1 parent
1e39345938
commit
70f3169bae
3 files changed
+15
No files matched your search
@@ -46,6 +46,12 @@ static void string_replace_all_occurrences_with_char(char *s, const char *occur,
|
||||
static int is_valid_index(const char *path, size_t *idx)
|
||||
{
|
||||
size_t i, len = strlen(path);
|
||||
/* an empty reference token is never a valid array index */
|
||||
if (len == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
/* this code-path optimizes a bit, for when we reference the 0-9 index range
|
||||
* in a JSON array and because leading zeros not allowed
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user