malloc size fix
authorborg323 <4010067-borg323@users.noreply.gitlab.com>
Mon, 20 May 2019 18:25:03 +0000 (21:25 +0300)
committerDavid Griffith <dave@661.org>
Mon, 27 May 2019 02:32:11 +0000 (19:32 -0700)
src/curses/ux_input.c

index 02908ffacc80903faf5c172bfef02ef819e7cd0e..60e861a93b67fb3a4327171ab35d22697e34cf00 100644 (file)
@@ -390,7 +390,7 @@ static void unix_add_to_history(zchar *str)
 
     if (*history_next != NULL)
        free( *history_next);
-    *history_next = (zchar *)malloc(zwordstrlen(str) + 1);
+    *history_next = (zchar *)malloc((zwordstrlen(str) + 1) * sizeof(zchar));
     zwordstrncpy( *history_next, str, zwordstrlen(str) + 1);
     RING_INC( history_next, history_buffer, history_end);
     history_view = history_next; /* Reset user frame after each line */