]> granicus.if.org Git - neomutt/commitdiff
fix crash caused by sidebar_folder_indent
authorStephen Gilles <sgilles@math.umd.edu>
Fri, 15 Apr 2016 00:57:03 +0000 (01:57 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 15 Apr 2016 00:57:03 +0000 (01:57 +0100)
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 <rich@flatcap.org>
sidebar.c

index 0a2199381c9dde0f2d5b5127131c258137af189b..47e518bbb25a58a90a0c9afed8221fc6ca7d8438 100644 (file)
--- 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;
                                }