diff --git a/src/browser.c b/src/browser.c
index 84b42cb98d57fc394b5aa74dfc0cd0542f464728..70b6ee6d0a160e67a476c10cd262de1c0c2364df 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -141,7 +141,7 @@ void browse_draw_item(struct dir *n, int row) {
   }
 
   /* format and add item to the list */
-  line = malloc(winrows+1);
+  line = malloc(winrows > 35 ? winrows+1 : 36);
   switch(graph) {
     case 0:
       sprintf(line, "%%c %%8s  %%c%%-%ds", wincols-13);