diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-03-14 18:57:54 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-03-14 18:57:54 +0000 |
commit | ce4a586edb6abd90c1036666159f831bd2a58895 (patch) | |
tree | b9fa59609eca6700fe84d05ccbb87afeac08329e | |
parent | 40e5e7c7eaab7c0806acf6cc8a51c8b15c7e0b1b (diff) | |
download | busybox-w32-ce4a586edb6abd90c1036666159f831bd2a58895.tar.gz busybox-w32-ce4a586edb6abd90c1036666159f831bd2a58895.tar.bz2 busybox-w32-ce4a586edb6abd90c1036666159f831bd2a58895.zip |
I forgot to malloc space for the NULL.
-Erik
-rw-r--r-- | lash.c | 2 | ||||
-rw-r--r-- | sh.c | 2 | ||||
-rw-r--r-- | shell/lash.c | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -936,7 +936,7 @@ char * strsep_space( char *string, int * index) | |||
936 | return NULL; | 936 | return NULL; |
937 | } | 937 | } |
938 | 938 | ||
939 | token = xmalloc(*index); | 939 | token = xmalloc(*index+1); |
940 | token[*index] = '\0'; | 940 | token[*index] = '\0'; |
941 | strncpy(token, string, *index); | 941 | strncpy(token, string, *index); |
942 | 942 | ||
@@ -936,7 +936,7 @@ char * strsep_space( char *string, int * index) | |||
936 | return NULL; | 936 | return NULL; |
937 | } | 937 | } |
938 | 938 | ||
939 | token = xmalloc(*index); | 939 | token = xmalloc(*index+1); |
940 | token[*index] = '\0'; | 940 | token[*index] = '\0'; |
941 | strncpy(token, string, *index); | 941 | strncpy(token, string, *index); |
942 | 942 | ||
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) | |||
936 | return NULL; | 936 | return NULL; |
937 | } | 937 | } |
938 | 938 | ||
939 | token = xmalloc(*index); | 939 | token = xmalloc(*index+1); |
940 | token[*index] = '\0'; | 940 | token[*index] = '\0'; |
941 | strncpy(token, string, *index); | 941 | strncpy(token, string, *index); |
942 | 942 | ||