From 5edaa3a81618b24ecf2b7ecfad486a39fe778c98 Mon Sep 17 00:00:00 2001 From: Graeme Campbell Date: Mon, 19 Aug 2024 16:20:59 +1200 Subject: [PATCH] Fix crash with queries to proxy-node schemas Querying the fields of a model with a proxy node, with the option of report-all causes a crash in apteryx-xml/schema.c in the function _sch_traverse_nodes. This is due to schema being set to NULL while handling the proxy node. This change exits the routine early if schema is set to NULL. --- schema.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/schema.c b/schema.c index 2a19f1a..1adf8ae 100644 --- a/schema.c +++ b/schema.c @@ -3149,6 +3149,12 @@ _sch_traverse_nodes (sch_instance * instance, sch_node * schema, GNode * parent, g_free (name); name = sch_name (schema); } + else + { + /* This can happen if a query is for a field of the proxy schema itself */ + rc = false; + goto exit; + } depth++; }