pidgin/pidgin

Parents 7f8a2f301a82
Children df4d0ab7eaae
facebook-json:`Special-case "$" to return root for json-glib < 0.99.2

Older glib versions didn't consider "$" to be a valid expression, and
threw this error:

Root node followed by invalid character '

(That's supposed to be '%c' with a \0)

Since this is possibly the simplest expression to parse, a g_strcmp0()
can do the job.

Thanks to advcomp2019 for reporting this bug and finding a test case
where this issue is reproducible every time (receiving events of people
joining or leaving in a groupchat)

Also thanks to EionRobb who realized what the bug was three hours ago
(and I didn't listen because I thought the previous bug was the same)
--- a/libpurple/protocols/facebook/json.c Mon Dec 21 16:31:00 2015 -0500
+++ b/libpurple/protocols/facebook/json.c Mon Dec 21 16:31:26 2015 -0500
@@ -290,6 +290,11 @@
JsonNode *node;
JsonNode *ret;
+ /* Special case for json-glib < 0.99.2 */
+ if (purple_strequal(expr, "$")) {
+ return json_node_copy(root);
+ }
+
node = json_path_query(expr, root, &err);
if (err != NULL) {