From 577e2516d0ed3669c7e9879ba9f04214658bfd1b Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 19 Mar 2024 17:06:07 +0100
Subject: [PATCH] valid: Check for NULL node->name in xmlSnprintfElements

Unfortunately, we can have NULL element names if xmlSetTreeDoc fails.

Reference: https://github.com/GNOME/libxml2/commit/577e2516d0ed3669c7e9879ba9f04214658bfd1b
Conflict: NA

---
 valid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/valid.c b/valid.c
index bfb8a77..975b706 100644
--- a/valid.c
+++ b/valid.c
@@ -5283,7 +5283,8 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
 			strcat(buf, " ...");
 		    return;
 		}
-	        strcat(buf, (char *) cur->name);
+                if (cur->name != NULL)
+	            strcat(buf, (char *) cur->name);
 		if (cur->next != NULL)
 		    strcat(buf, " ");
 		break;
-- 
2.33.0

