From 9db356bd9b8629752ed622a31e90529414fcda80 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 1 Feb 2014 09:12:51 +0100 Subject: [PATCH] core: fix crash when creating two bars with same name but different case (bug #41418) --- ChangeLog | 2 ++ src/gui/gui-bar.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 841ff6a40..63aa75f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.3 (under dev) +* core: fix crash when creating two bars with same name but different case + (bug #41418) * core: fix display of read marker when all buffer lines are unread and that option weechat.look.read_marker_always_show is on * core: fix memory leak in regex matching when evaluating expression diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index d48b59a89..4a48124c8 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -520,7 +520,7 @@ gui_bar_search (const char *name) for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if (strcmp (ptr_bar->name, name) == 0) + if (string_strcasecmp (ptr_bar->name, name) == 0) return ptr_bar; } @@ -550,7 +550,7 @@ gui_bar_search_with_option_name (const char *option_name) { for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if (strcmp (ptr_bar->name, bar_name) == 0) + if (string_strcasecmp (ptr_bar->name, bar_name) == 0) break; } free (bar_name); @@ -1342,7 +1342,7 @@ gui_bar_default_items (const char *bar_name) for (i = 0; gui_bar_items_default_for_bars[i][0]; i++) { - if (strcmp (gui_bar_items_default_for_bars[i][0], bar_name) == 0) + if (string_strcasecmp (gui_bar_items_default_for_bars[i][0], bar_name) == 0) return gui_bar_items_default_for_bars[i][1]; } @@ -2078,7 +2078,7 @@ gui_bar_update (const char *name) for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) - && (strcmp (ptr_bar->name, name) == 0)) + && (string_strcasecmp (ptr_bar->name, name) == 0)) { gui_bar_ask_refresh (ptr_bar); }