From: Stephen Gilles Date: Fri, 15 Apr 2016 00:57:03 +0000 (+0100) Subject: fix crash caused by sidebar_folder_indent X-Git-Tag: neomutt-20160416~5^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8308549eb2e71e1aa85c3250da5cb54289c326d;p=neomutt fix crash caused by sidebar_folder_indent Certain folder settings, combined with sidebar_folder_indent, caused an overflow when trying to compare paths. set folder="~/mail/folder" mailboxes "~/mail/folder/" Note the trailing / on the mailbox name. Signed-off-by: Richard Russon --- diff --git a/sidebar.c b/sidebar.c index 0a2199381..47e518bbb 100644 --- a/sidebar.c +++ b/sidebar.c @@ -766,9 +766,9 @@ draw_sidebar (int first_row, int num_rows, int div_width) const char *tmp_folder_name; int lastsep = 0; tmp_folder_name = b->path + maildirlen + 1; - for (i = 0; i < strlen (tmp_folder_name) - 1; i++) { - if (SidebarDelimChars && - strchr (SidebarDelimChars, tmp_folder_name[i])) { + int tmplen = (int) strlen (tmp_folder_name) - 1; + for (i = 0; i < tmplen; i++) { + if (SidebarDelimChars && strchr (SidebarDelimChars, tmp_folder_name[i])) { sidebar_folder_depth++; lastsep = i + 1; }