From 78cdb02be61695e7ac9eedce5796c22b570f568e Mon Sep 17 00:00:00 2001 From: "Tobias R. Henle" Date: Mon, 5 Apr 2021 21:27:48 +0200 Subject: [PATCH 1/2] Fix: Don't allow a separator as root for submenus. --- xmenu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xmenu.c b/xmenu.c index afb4301..a4c29e1 100644 --- a/xmenu.c +++ b/xmenu.c @@ -432,6 +432,10 @@ buildmenutree(unsigned level, const char *label, const char *output, char *file) for (item = prevmenu->list; item->next != NULL; item = item->next) ; + /* a separator is no valid root for a submenu */ + if (!item->label) + errx(1, "a separator is no valid root for a submenu"); + prevmenu = menu; menu->caller = item; item->submenu = menu; From 2e7a6bdcf3a2656fcabcc51d87ac3faafeaacb2c Mon Sep 17 00:00:00 2001 From: "Tobias R. Henle" Date: Mon, 5 Apr 2021 21:28:21 +0200 Subject: [PATCH 2/2] Fix: Handle missing (NULL pointer) output for separator. --- xmenu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xmenu.c b/xmenu.c index a4c29e1..9b3a250 100644 --- a/xmenu.c +++ b/xmenu.c @@ -721,8 +721,10 @@ setupmenu(struct Menu *menu, XClassHint *classh) /* set window title (used if wflag is on) */ if (menu->parent == NULL) { title = classh->res_name; - } else { + } else if (menu->caller->output) { title = menu->caller->output; + } else { + title = "\0"; } XStringListToTextProperty(&title, 1, &wintitle);