From: Denys Vlasenko Date: Tue, 15 Feb 2011 17:35:54 +0000 (+0100) Subject: echo: fix SEGV when run with no args X-Git-Tag: 1_19_0~282 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4fdb67cc65e93967448bb28e4cb810ad5648bfea;p=oweals%2Fbusybox.git echo: fix SEGV when run with no args Signed-off-by: Denys Vlasenko --- diff --git a/coreutils/echo.c b/coreutils/echo.c index 42c3f9ed8..72e18c161 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -97,7 +97,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv) buflen += strlen(arg) + 1; pp++; } - out = buffer = xmalloc(buflen); + out = buffer = xmalloc(buflen + 1); /* +1 is needed for "no args" case */ while ((arg = *argv) != NULL) { int c;