[json-glib] Handle invalid path : missing member name after .
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] Handle invalid path : missing member name after .
- Date: Mon, 2 Dec 2013 11:30:55 +0000 (UTC)
commit b5570400cbd95f46373dfce2877c6599802bec21
Author: bi <bisnard antidot net>
Date: Wed May 15 16:06:48 2013 +0200
Handle invalid path : missing member name after .
Signed-off-by: Emmanuele Bassi <ebassi gnome org>
json-glib/json-path.c | 8 ++++++++
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]