From 81aeeeb1272e4a729bc65e30f8502b7a5a9a14dd Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 1 May 2013 04:52:32 +0200 Subject: [PATCH] Forgot to allocate one byte for string-terminating null byte. --- roguelike.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roguelike.c b/roguelike.c index ee5dbe4..34f3c85 100644 --- a/roguelike.c +++ b/roguelike.c @@ -262,7 +262,7 @@ void init_keybindings(struct World * world) { c = getc(file); while (EOF != c) { if ('\n' == c) { - keybindings[keycount].name = calloc(commcount, sizeof(char)); + keybindings[keycount].name = calloc(commcount + 1, sizeof(char)); memcpy(keybindings[keycount].name, command, commcount); keybindings[keycount].key = key; keycount++; -- 2.30.2