Commit 6074d4d8 6074d4d856c861d0a5df9b39d7421bc186ce2056 by Sergey Poznyakoff

Fix eventual memory overrun

* mail/mail.c (mail_mainloop): Check command length before
trying to access its last byte.
1 parent 25f14bdd
...@@ -558,7 +558,7 @@ mail_mainloop (char *(*input) (void *, int), ...@@ -558,7 +558,7 @@ mail_mainloop (char *(*input) (void *, int),
558 while ((command = (*input) (closure, 0)) != NULL) 558 while ((command = (*input) (closure, 0)) != NULL)
559 { 559 {
560 int len = strlen (command); 560 int len = strlen (command);
561 while (command[len-1] == '\\') 561 while (len > 0 && command[len-1] == '\\')
562 { 562 {
563 char *buf; 563 char *buf;
564 char *command2 = (*input) (closure, 1); 564 char *command2 = (*input) (closure, 1);
......