diff options
| author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 08:42:04 +0000 |
|---|---|---|
| committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 08:42:04 +0000 |
| commit | b4305f8d9124d6e69fbabef2056600a3242681d0 (patch) | |
| tree | 8e2c15c05d8bf2789e50eeda9f4cf774a6c6b8c1 | |
| parent | ed7003a9f347e0cd92499872ac834cd81481b997 (diff) | |
Notes
| -rw-r--r-- | sys/kern/imgact_shell.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/imgact_shell.c b/sys/kern/imgact_shell.c index 42a93936154b..9604f415b1e8 100644 --- a/sys/kern/imgact_shell.c +++ b/sys/kern/imgact_shell.c @@ -75,18 +75,19 @@ exec_shell_imgact(imgp) offset = 0; while (ihp < &image_header[MAXSHELLCMDLEN]) { /* Skip any whitespace */ - while ((*ihp == ' ') || (*ihp == '\t')) { + if ((*ihp == ' ') || (*ihp == '\t')) { ihp++; continue; } /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#')) + if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) break; /* Found a token */ while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && - (*ihp != '#')) { + (*ihp != '#') && (*ihp != '\0') && + (ihp < &image_header[MAXSHELLCMDLEN])) { offset++; ihp++; } @@ -140,18 +141,19 @@ exec_shell_imgact(imgp) offset = 0; while (ihp < &image_header[MAXSHELLCMDLEN]) { /* Skip whitespace */ - while ((*ihp == ' ' || *ihp == '\t')) { + if ((*ihp == ' ') || (*ihp == '\t')) { ihp++; continue; } /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#')) + if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) break; /* Found a token, copy it */ - while ((*ihp != ' ') && (*ihp != '\t') && - (*ihp != '\n') && (*ihp != '#')) { + while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && + (*ihp != '#') && (*ihp != '\0') && + (ihp < &image_header[MAXSHELLCMDLEN])) { imgp->args->begin_argv[offset++] = *ihp++; } imgp->args->begin_argv[offset++] = '\0'; |
