aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-02-09 06:05:01 +0000
committerErik Andersen <andersen@codepoet.org>2000-02-09 06:05:01 +0000
commit07f56040466b8d93000a42909a24172ac2069c73 (patch)
treefa1366c513e765680f747e802ce864f136d8a175
parentd7ce5e780282148f86941ebb6babc7ae4b50b07e (diff)
downloadbusybox-07f56040466b8d93000a42909a24172ac2069c73.tar.gz
Fix a possible /linuxrc crash.
-Erik
-rw-r--r--init.c3
-rw-r--r--init/init.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/init.c b/init.c
index 2f2203b38..0157873ab 100644
--- a/init.c
+++ b/init.c
@@ -879,7 +879,8 @@ extern int init_main(int argc, char **argv)
/* Fix up argv[0] to be certain we claim to be init */
strncpy(argv[0], "init", strlen(argv[0])+1);
- strncpy(argv[1], "\0", strlen(argv[1])+1);
+ if (argc > 1)
+ strncpy(argv[1], "\0", strlen(argv[1])+1);
/* Now run everything that needs to be run */
diff --git a/init/init.c b/init/init.c
index 2f2203b38..0157873ab 100644
--- a/init/init.c
+++ b/init/init.c
@@ -879,7 +879,8 @@ extern int init_main(int argc, char **argv)
/* Fix up argv[0] to be certain we claim to be init */
strncpy(argv[0], "init", strlen(argv[0])+1);
- strncpy(argv[1], "\0", strlen(argv[1])+1);
+ if (argc > 1)
+ strncpy(argv[1], "\0", strlen(argv[1])+1);
/* Now run everything that needs to be run */