diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-15 18:35:54 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-15 18:35:54 +0100 |
commit | 4fdb67cc65e93967448bb28e4cb810ad5648bfea (patch) | |
tree | dcdae361dd7791cad00dcbf89d52244dea818063 | |
parent | 28556b95febc77ebdd2d2f2e0be4a0157dcaf735 (diff) | |
download | busybox-w32-4fdb67cc65e93967448bb28e4cb810ad5648bfea.tar.gz busybox-w32-4fdb67cc65e93967448bb28e4cb810ad5648bfea.tar.bz2 busybox-w32-4fdb67cc65e93967448bb28e4cb810ad5648bfea.zip |
echo: fix SEGV when run with no args
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/echo.c | 2 |
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) | |||
97 | buflen += strlen(arg) + 1; | 97 | buflen += strlen(arg) + 1; |
98 | pp++; | 98 | pp++; |
99 | } | 99 | } |
100 | out = buffer = xmalloc(buflen); | 100 | out = buffer = xmalloc(buflen + 1); /* +1 is needed for "no args" case */ |
101 | 101 | ||
102 | while ((arg = *argv) != NULL) { | 102 | while ((arg = *argv) != NULL) { |
103 | int c; | 103 | int c; |