From 5ead41a3fb44dffd9c58cb2531bac0ac93aa8c21 Mon Sep 17 00:00:00 2001 From: kraai Date: Tue, 19 Sep 2000 06:46:44 +0000 Subject: Avoid segfaults by not using snprintf to copy strings. git-svn-id: svn://busybox.net/trunk/busybox@1069 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- sh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sh.c') diff --git a/sh.c b/sh.c index a2969082f..cbaf16ef8 100644 --- a/sh.c +++ b/sh.c @@ -1023,7 +1023,8 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi /* Make some space to hold just the backticked command */ charptr1 = charptr2 = xmalloc(1+ptr-src); - snprintf(charptr1, 1+ptr-src, src); + memcpy(charptr1, src, ptr-src); + charptr1[ptr-src] = '\0'; newJob = xmalloc(sizeof(struct job)); /* Now parse and run the backticked command */ if (!parseCommand(&charptr1, newJob, &njobList, inBg) -- cgit v1.2.3-55-g6feb