summaryrefslogtreecommitdiff
path: root/json-glib/json-path.c
diff options
context:
space:
mode:
authorbi <bisnard@antidot.net>2013-05-15 16:06:48 +0200
committerEmmanuele Bassi <ebassi@gnome.org>2013-12-02 11:18:39 +0000
commitb5570400cbd95f46373dfce2877c6599802bec21 (patch)
treec5dfe9957e7e93558057d9ed5448bb1bc2ad7de3 /json-glib/json-path.c
parent730761d0ab3b9a72cea0b5cf806e656ec93f8a11 (diff)
downloadjson-glib-b5570400cbd95f46373dfce2877c6599802bec21.tar.gz
Handle invalid path : missing member name after .
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Diffstat (limited to 'json-glib/json-path.c')
-rw-r--r--json-glib/json-path.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index 014abeb..6199f51 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -480,6 +480,14 @@ json_path_compile (JsonPath *path,
while (!(*end_p == '.' || *end_p == '[' || *end_p == '\0'))
end_p += 1;
+ if (end_p == p + 1)
+ {
+ g_set_error_literal (error, JSON_PATH_ERROR,
+ JSON_PATH_ERROR_INVALID_QUERY,
+ _("Missing member name or wildcard after . character"));
+ goto fail;
+ }
+
node = g_new0 (PathNode, 1);
node->node_type = JSON_PATH_NODE_CHILD_MEMBER;
node->data.member_name = g_strndup (p + 1, end_p - p - 1);