I forgot to malloc space for the NULL.
authorEric Andersen <andersen@codepoet.org>
Wed, 14 Mar 2001 18:57:54 +0000 (18:57 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 14 Mar 2001 18:57:54 +0000 (18:57 -0000)
 -Erik

lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index 8edb783..1977d5f 100644 (file)
--- 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 8edb783..1977d5f 100644 (file)
--- 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); 
 
index 8edb783..1977d5f 100644 (file)
@@ -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);