From: Eric S. Raymond Date: Thu, 29 Jun 2017 17:43:36 +0000 (-0400) Subject: Fix an OB1 bug in allocation. X-Git-Tag: 1.1~22 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=58a8a761e25ee45d6c300f2c22993f160db86e11;p=open-adventure.git Fix an OB1 bug in allocation. --- diff --git a/misc.c b/misc.c index 4f32246..46a3d60 100644 --- a/misc.c +++ b/misc.c @@ -106,8 +106,8 @@ void tokenize(char* raw, long tokens[4]) // grab the first two words char* words[2]; - words[0] = (char*) xmalloc(strlen(raw)); - words[1] = (char*) xmalloc(strlen(raw)); + words[0] = (char*) xmalloc(strlen(raw)+1); + words[1] = (char*) xmalloc(strlen(raw)+1); int word_count = sscanf(raw, "%s%s", words[0], words[1]); // make space for substrings and zero it out