Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-02-15 20:35:54 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2011-02-15 20:35:54 +0300
commit4fdb67cc65e93967448bb28e4cb810ad5648bfea (patch)
treedcdae361dd7791cad00dcbf89d52244dea818063 /coreutils/echo.c
parent28556b95febc77ebdd2d2f2e0be4a0157dcaf735 (diff)
echo: fix SEGV when run with no args
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/echo.c')
-rw-r--r--coreutils/echo.c2
1 files changed, 1 insertions, 1 deletions
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;