From 16f6a5b16d2bcf3ebbeed72ea4b949416c64289f Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Mon, 21 Sep 2026 21:03:48 -0700 Subject: [PATCH] XML: guard against content allocation failure Report a memory error when libxml cannot allocate node content instead of passing a NULL pointer to the string conversion path. --- external/njs_xml_module.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/external/njs_xml_module.c b/external/njs_xml_module.c index 08979bec..e745a5d6 100644 --- a/external/njs_xml_module.c +++ b/external/njs_xml_module.c @@ -988,6 +988,11 @@ njs_xml_node_ext_text(njs_vm_t *vm, njs_object_prop_t *unused, uint32_t unused1, if (retval != NULL && setval == NULL) { content.start = xmlNodeGetContent(current); + if (njs_slow_path(content.start == NULL)) { + njs_vm_memory_error(vm); + return NJS_ERROR; + } + ret = njs_vm_value_string_create(vm, retval, content.start, njs_strlen(content.start)); -- 2.47.3