echo: fix SEGV when run with no args
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
28556b95fe
commit
4fdb67cc65
@ -97,7 +97,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
buflen += strlen(arg) + 1;
|
buflen += strlen(arg) + 1;
|
||||||
pp++;
|
pp++;
|
||||||
}
|
}
|
||||||
out = buffer = xmalloc(buflen);
|
out = buffer = xmalloc(buflen + 1); /* +1 is needed for "no args" case */
|
||||||
|
|
||||||
while ((arg = *argv) != NULL) {
|
while ((arg = *argv) != NULL) {
|
||||||
int c;
|
int c;
|
||||||
|
Loading…
Reference in New Issue
Block a user