]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/normal/menu_entry.c (complete): Make sure that width is >0.
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 25 Oct 2013 22:07:59 +0000 (00:07 +0200)
committerVladimir Serbinenko <phcoder@gmail.com>
Fri, 25 Oct 2013 22:07:59 +0000 (00:07 +0200)
ChangeLog
grub-core/normal/menu_entry.c

index c942cc66812cb97b783abc6d03da28730f0dd030..abe03cd51714f776fab9777f6a0d74bd2ae92eb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-25  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/normal/menu_entry.c (complete): Make sure that width is >0.
+
 2013-10-25  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Make char and string width grub_size_t rather than grub_ssize_t.
index 58042404b7d01b209b35a2ee2d8186cea508d330..8ab9e753d966b2666fe685f1ecb2d32de842240d 100644 (file)
@@ -1029,12 +1029,14 @@ complete (struct screen *screen, int continuous, int update)
       if (restore)
        for (i = 0; i < screen->nterms; i++)
          {
-           int width = grub_term_width (screen->terms[i].term) - 2;
+           unsigned width = grub_term_width (screen->terms[i].term);
+           if (width > 2)
+             width -= 2;
            if (width > 15)
              width -= 6;
-           int num_sections = ((completion_buffer.len
-                                + width - 1)
-                               / width);
+           unsigned num_sections = ((completion_buffer.len
+                                     + width - 1)
+                                    / width);
            grub_uint32_t *endp;
            struct grub_term_coordinate pos;
            grub_uint32_t *p = ucs4;