From: Christian Heller Date: Wed, 1 May 2013 02:52:32 +0000 (+0200) Subject: Forgot to allocate one byte for string-terminating null byte. X-Git-Tag: tce~1328 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/feed.xml?a=commitdiff_plain;h=81aeeeb1272e4a729bc65e30f8502b7a5a9a14dd;p=plomrogue Forgot to allocate one byte for string-terminating null byte. --- 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++;