From e037ae3684928a2fbf4a3994562a322f5d3b0c71 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 2 Jul 2017 23:01:49 +0200 Subject: [PATCH] util: fix parsing of XDG menus with multiple groups The specification for XDG menu files allows having more than one group and assumes no constraint on their order. The original code assumed that once the proper group marker was found, everything after was part of it, causing misinterpretation of some data, like taking the wrong launch command. This patch stops the parsing of the menu XDG file when a new group is found, hence implementing the expected behaviour. Reported-by: Andreas Metzler --- util/wmmenugen_parse_xdg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/wmmenugen_parse_xdg.c b/util/wmmenugen_parse_xdg.c index fc5f6b19..31ee8130 100644 --- a/util/wmmenugen_parse_xdg.c +++ b/util/wmmenugen_parse_xdg.c @@ -132,6 +132,11 @@ void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback) /* start processing group */ memset(buf, 0, sizeof(buf)); continue; + } else if (p[0] == '[') { + /* If we find a new group and the previous group was the main one, + * we stop all further processing + */ + if (InGroup) break; } if (!InGroup) { -- 2.11.4.GIT