]> granicus.if.org Git - neomutt/commitdiff
prevent buffer underrun
authorRichard Russon <rich@flatcap.org>
Tue, 3 Jul 2018 09:34:07 +0000 (10:34 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 3 Jul 2018 09:34:08 +0000 (10:34 +0100)
Thanks @l2dy

muttlib.c

index 86c7cb3fb4645093bb34ecb9fc8049ed42dc95f9..264c5677afe4efad319805e394ef7ae5866bcb41 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -1482,6 +1482,8 @@ void mutt_get_parent_path(char *output, char *path, size_t olen)
   {
     mutt_str_strfcpy(output, path, olen);
     int n = mutt_str_strlen(output);
+    if (n == 0)
+      return;
 
     /* remove any final trailing '/' */
     if (output[n - 1] == '/')