File CVE-2023-45920.patch of Package xfig.33150

From ec49cde00dbd6f7f45d8e386795079d5d636496f Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Tue, 25 Jul 2023 09:24:42 +0200
Subject: [PATCH] Avoid possible null pointer dereference, ticket #155

---
 src/main.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- src/main.c
+++ src/main.c	2024-03-27 13:46:48.748525906 +0000
@@ -1209,11 +1209,12 @@ main(int argc, char **argv)
 
 
     /* Set the input field to true to allow keyboard input */
-    wmhints = XGetWMHints(tool_d, tool_w);
-    wmhints->flags |= InputHint;/* add in input hint */
-    wmhints->input = True;
-    XSetWMHints(tool_d, tool_w, wmhints);
-    XFree((char *) wmhints);
+    if ((wmhints = XGetWMHints(tool_d, tool_w))) {
+	wmhints->flags |= InputHint;/* add in input hint */
+	wmhints->input = True;
+	XSetWMHints(tool_d, tool_w, wmhints);
+	XFree(wmhints);
+    }
 
     if (appres.RHS_PANEL) {	/* side button panel is on right size */
 	FirstArg(XtNfromHoriz, 0);
openSUSE Build Service is sponsored by