summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ungol.org>2020-03-31 06:25:32 -0400
committerJakob Kaivo <jkk@ungol.org>2020-03-31 06:25:32 -0400
commita254b856b526bec51592eee518f891da12d012eb (patch)
treecea42fe0a153dc2ce8c62a040cc5610253a294c2
parent4a33ca6b85013f69ad89418cac42ff86a0e3ea89 (diff)
make sure strings are null terminated when rus as echoHEADmaster
-rw-r--r--printf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/printf.c b/printf.c
index 08a7831..da14fcc 100644
--- a/printf.c
+++ b/printf.c
@@ -303,10 +303,11 @@ int echo_main(int argc, char *argv[])
{
for (int i = 1; i < argc; i++) {
char ebuf[strlen(argv[i]) + 1];
+ memset(ebuf, '\0', sizeof(ebuf));
int quit = echo(argv[i], ebuf);
printf("%s", ebuf);
if (quit) {
- return(errors);
+ return errors;
}
putchar(i == argc - 1 ? '\n' : ' ');
}