hush: fix read builtin to not read ahead past eol and to not use

insane amounts of stack. Testsuite updated.
This commit is contained in:
Denis Vlasenko
2007-06-13 06:47:47 +00:00
parent f5f75c5e82
commit d67cef2425
10 changed files with 68 additions and 31 deletions

View File

@ -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