diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-13 06:47:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-13 06:47:47 +0000 |
commit | d67cef2425fb5e75b75d52d9a308da6d29cd7a0d (patch) | |
tree | 5d034f518dfae9a933a701e8c42da4acbf0cb42d /modutils/insmod.c | |
parent | f5f75c5e82d47613847c356664e47c4be69e73aa (diff) | |
download | busybox-w32-d67cef2425fb5e75b75d52d9a308da6d29cd7a0d.tar.gz busybox-w32-d67cef2425fb5e75b75d52d9a308da6d29cd7a0d.tar.bz2 busybox-w32-d67cef2425fb5e75b75d52d9a308da6d29cd7a0d.zip |
hush: fix read builtin to not read ahead past eol and to not use
insane amounts of stack. Testsuite updated.
Diffstat (limited to 'modutils/insmod.c')
-rw-r--r-- | modutils/insmod.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index a81ca7fba..b9d8a0243 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -4262,6 +4262,7 @@ int insmod_ng_main(int argc, char **argv) | |||
4262 | { | 4262 | { |
4263 | long ret; | 4263 | long ret; |
4264 | size_t len; | 4264 | size_t len; |
4265 | int optlen; | ||
4265 | void *map; | 4266 | void *map; |
4266 | char *filename, *options; | 4267 | char *filename, *options; |
4267 | 4268 | ||
@@ -4270,12 +4271,12 @@ int insmod_ng_main(int argc, char **argv) | |||
4270 | bb_show_usage(); | 4271 | bb_show_usage(); |
4271 | 4272 | ||
4272 | /* Rest is options */ | 4273 | /* Rest is options */ |
4273 | options = xstrdup(""); | 4274 | options = xzalloc(1); |
4275 | optlen = 0; | ||
4274 | while (*++argv) { | 4276 | while (*++argv) { |
4275 | int optlen = strlen(options); | ||
4276 | options = xrealloc(options, optlen + 2 + strlen(*argv) + 2); | 4277 | options = xrealloc(options, optlen + 2 + strlen(*argv) + 2); |
4277 | /* Spaces handled by "" pairs, but no way of escaping quotes */ | 4278 | /* Spaces handled by "" pairs, but no way of escaping quotes */ |
4278 | sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv); | 4279 | optlen += sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv); |
4279 | } | 4280 | } |
4280 | 4281 | ||
4281 | #if 0 | 4282 | #if 0 |