From 02c925e3932929a5eb4e9a2d6d025f383670ebf6 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 17 Apr 2012 14:15:15 +0200 Subject: [PATCH] Fix MenuNameToItem This function could crash when called with ann argument that did not contain a period, while the idea was that it should handle this as if the item is in noMenu (for user-specified key binding to non-menu funtions). --- menus.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/menus.c b/menus.c index d5744f7..f786eda 100644 --- a/menus.c +++ b/menus.c @@ -869,14 +869,14 @@ Menu menuBar[] = { MenuItem * MenuNameToItem (char *menuName) { - int i; + int i=0; char buf[MSG_SIZ], *p; MenuItem *menuTab; static MenuItem a = { NULL, NULL, NothingProc }; extern Option mainOptions[]; safeStrCpy(buf, menuName, MSG_SIZ); p = strchr(buf, '.'); - if(!p) menuTab = noMenu; else { + if(!p) menuTab = noMenu, p = menuName; else { *p++ = NULLCHAR; for(i=0; menuBar[i].name; i++) if(!strcmp(buf, menuBar[i].name)) break; -- 1.7.0.4