From: Eric Andersen Date: Wed, 14 Mar 2001 18:57:54 +0000 (-0000) Subject: I forgot to malloc space for the NULL. X-Git-Tag: 0_50~33 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ce4a586edb6abd90c1036666159f831bd2a58895;p=oweals%2Fbusybox.git I forgot to malloc space for the NULL. -Erik --- diff --git a/lash.c b/lash.c index 8edb78369..1977d5fdc 100644 --- a/lash.c +++ b/lash.c @@ -936,7 +936,7 @@ char * strsep_space( char *string, int * index) return NULL; } - token = xmalloc(*index); + token = xmalloc(*index+1); token[*index] = '\0'; strncpy(token, string, *index); diff --git a/sh.c b/sh.c index 8edb78369..1977d5fdc 100644 --- a/sh.c +++ b/sh.c @@ -936,7 +936,7 @@ char * strsep_space( char *string, int * index) return NULL; } - token = xmalloc(*index); + token = xmalloc(*index+1); token[*index] = '\0'; strncpy(token, string, *index); diff --git a/shell/lash.c b/shell/lash.c index 8edb78369..1977d5fdc 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -936,7 +936,7 @@ char * strsep_space( char *string, int * index) return NULL; } - token = xmalloc(*index); + token = xmalloc(*index+1); token[*index] = '\0'; strncpy(token, string, *index);