diff options
author | Denis Vlasenko | 2007-06-13 06:47:47 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-06-13 06:47:47 +0000 |
commit | d67cef2425fb5e75b75d52d9a308da6d29cd7a0d (patch) | |
tree | 5d034f518dfae9a933a701e8c42da4acbf0cb42d /modutils | |
parent | f5f75c5e82d47613847c356664e47c4be69e73aa (diff) | |
download | busybox-d67cef2425fb5e75b75d52d9a308da6d29cd7a0d.zip busybox-d67cef2425fb5e75b75d52d9a308da6d29cd7a0d.tar.gz |
hush: fix read builtin to not read ahead past eol and to not use
insane amounts of stack. Testsuite updated.
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/insmod.c | 7 | ||||
-rw-r--r-- | modutils/modprobe.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index a81ca7f..b9d8a02 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -4262,6 +4262,7 @@ int insmod_ng_main(int argc, char **argv) { long ret; size_t len; + int optlen; void *map; char *filename, *options; @@ -4270,12 +4271,12 @@ int insmod_ng_main(int argc, char **argv) bb_show_usage(); /* Rest is options */ - options = xstrdup(""); + options = xzalloc(1); + optlen = 0; while (*++argv) { - int optlen = strlen(options); options = xrealloc(options, optlen + 2 + strlen(*argv) + 2); /* Spaces handled by "" pairs, but no way of escaping quotes */ - sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv); + optlen += sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv); } #if 0 diff --git a/modutils/modprobe.c b/modutils/modprobe.c index a7c6307..dbed4ea 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -234,7 +234,7 @@ static void include_conf(struct dep_t **first, struct dep_t **current, char *buf { int continuation_line = 0; - // alias parsing is not 100% correct (no correct handling of continuation lines within an alias) ! + // alias parsing is not 100% correct (no correct handling of continuation lines within an alias)! while (reads(fd, buffer, buflen)) { int l; |