changeset 35282:38a5d56c389c

Fix allocation that could in theory be too small for the terminating NULL. It should only have been possible to actually trigger when chapter name and start string were both empty.
author reimar
date Sat, 10 Nov 2012 11:49:37 +0000
parents fbd8efe9e5a8
children e16e3b681703
files libmenu/menu_chapsel.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmenu/menu_chapsel.c	Sat Nov 10 10:56:36 2012 +0000
+++ b/libmenu/menu_chapsel.c	Sat Nov 10 11:49:37 2012 +0000
@@ -76,7 +76,7 @@
     int l = strlen(fmt);
     int cl = strlen(chapter_name);
     int sl = strlen(start);
-    char *str = malloc(l + cl + sl);
+    char *str = malloc(l + cl + sl + 1);
     char *p;
     strcpy(str, fmt);
     p = strstr(str, ctag);