Permalink
Browse files

do not execute a command that exceeds the maximum length

  • Loading branch information...
1 parent 2e7a35b commit ebdcdfb0ed88385e6411b247388e2478711652e2 @koblenski committed Jan 9, 2017
Showing with 1 addition and 262 deletions.
  1. +0 −81 golden_output.txt
  2. +0 −90 golden_output_verbose.txt
  3. +0 −90 output.txt
  4. +1 −1 shell.cpp
View
@@ -97,87 +97,6 @@ koblensk> Command Line :
koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
Input exceeds valid command length.
Input must be at most 512 characters.
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
-Doing execv
-901234567890
-
- 0
-901234567890
-
-Doing execv /usr/bin/
-901234567890
-
- 0
-901234567890
-
-Doing execv /bin/
-901234567890
-
- 0
-901234567890
-
-
-Command Not Found.
-Please check your path and filename.
-Note: programs needing user input cannot be executed with this shell.
-
-koblensk> Command Line : /bin/ls -a test
- 0 : /bin/ls
- 1 : -a
- 2 : test
- 0 arg /bin/ls
- 1 arg -a
- 2 arg test
-/bin/ls
-/bin/ls
-koblensk> Command Line : cat batch.txt
- 0 : cat
- 1 : batch.txt
- 0 arg cat
- 1 arg batch.txt
-cat
-cat
-koblensk> Command Line : this is an invalid command
- 0 : this
- 1 : is
- 2 : an
- 3 : invalid
- 4 : command
- 0 arg this
- 1 arg is
- 2 arg an
- 3 arg invalid
- 4 arg command
-this
-this
-koblensk> Command Line :
-koblensk> Command Line :
-koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
-Input exceeds valid command length.
-Input must be at most 512 characters.
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
koblensk> Command Line : exit invalid
0 : exit
1 : invalid
@@ -103,96 +103,6 @@ koblensk> Command Line :
koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
Input exceeds valid command length.
Input must be at most 512 characters.
-
-901234567890
-
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
-Doing execv
-901234567890
-
- 0
-901234567890
-
-Doing execv /usr/bin/
-901234567890
-
- 0
-901234567890
-
-Doing execv /bin/
-901234567890
-
- 0
-901234567890
-
-
-Command Not Found.
-Please check your path and filename.
-Note: programs needing user input cannot be executed with this shell.
-
-koblensk> Command Line : /bin/ls -a test
-/bin/ls -a test
- 0 : /bin/ls
- 1 : -a
- 2 : test
- 0 arg /bin/ls
- 1 arg -a
- 2 arg test
-/bin/ls
-/bin/ls
-koblensk> Command Line : cat batch.txt
-cat batch.txt
- 0 : cat
- 1 : batch.txt
- 0 arg cat
- 1 arg batch.txt
-cat
-cat
-koblensk> Command Line : this is an invalid command
-this is an invalid command
- 0 : this
- 1 : is
- 2 : an
- 3 : invalid
- 4 : command
- 0 arg this
- 1 arg is
- 2 arg an
- 3 arg invalid
- 4 arg command
-this
-this
-koblensk> Command Line :
-koblensk> Command Line :
-koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
-Input exceeds valid command length.
-Input must be at most 512 characters.
-
-901234567890
-
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
koblensk> Command Line : exit invalid
exit invalid
0 : exit
View
@@ -103,96 +103,6 @@ koblensk> Command Line :
koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
Input exceeds valid command length.
Input must be at most 512 characters.
-
-901234567890
-
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
-Doing execv
-901234567890
-
- 0
-901234567890
-
-Doing execv /usr/bin/
-901234567890
-
- 0
-901234567890
-
-Doing execv /bin/
-901234567890
-
- 0
-901234567890
-
-
-Command Not Found.
-Please check your path and filename.
-Note: programs needing user input cannot be executed with this shell.
-
-koblensk> Command Line : /bin/ls -a test
-/bin/ls -a test
- 0 : /bin/ls
- 1 : -a
- 2 : test
- 0 arg /bin/ls
- 1 arg -a
- 2 arg test
-/bin/ls
-/bin/ls
-koblensk> Command Line : cat batch.txt
-cat batch.txt
- 0 : cat
- 1 : batch.txt
- 0 arg cat
- 1 arg batch.txt
-cat
-cat
-koblensk> Command Line : this is an invalid command
-this is an invalid command
- 0 : this
- 1 : is
- 2 : an
- 3 : invalid
- 4 : command
- 0 arg this
- 1 arg is
- 2 arg an
- 3 arg invalid
- 4 arg command
-this
-this
-koblensk> Command Line :
-koblensk> Command Line :
-koblensk> Command Line : echo 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
-Input exceeds valid command length.
-Input must be at most 512 characters.
-
-901234567890
-
- 0 :
-901234567890
-
- 0 arg
-901234567890
-
-
-901234567890
-
-
-901234567890
-
koblensk> Command Line : exit invalid
exit invalid
0 : exit
View
@@ -102,7 +102,7 @@ char *get_command_line_from(FILE *input_src) {
while (strlen(fgets(command_line, MAX_COMMAND_LENGTH, input_src)) >=
(unsigned)MAX_COMMAND_LENGTH - 1)
;
- command_line[0] = '\n';
+ return NULL;
}
return command_line;

0 comments on commit ebdcdfb

Please sign in to comment.