]> Kevux Git Server - fll/commit
Update: Console improvements with related security fix.
authorKevin Day <thekevinday@gmail.com>
Thu, 17 Feb 2022 03:05:06 +0000 (21:05 -0600)
committerKevin Day <thekevinday@gmail.com>
Thu, 17 Feb 2022 03:05:06 +0000 (21:05 -0600)
commit0fda79562ddd3af9558dd6fde4d963191334456a
tree47bc5bc89c78ac22f7851e14a9765750403dd8b5
parent42f685b7e4628c092858b7f91ee3b43abc685b9f
Update: Console improvements with related security fix.

Add f_console_environment_process() to process environment variable data passed via main().
Add appropriate testing.

Setup all level 3 (programs) to have the environment data (envp).
The level 3 currently do not utilize this.

While looking at the tests, I realized that I noticed that I did not fully verify the sanity of the passed argc, argv, and now envp.
This is a security issue in that invalid data (argc could be wrong, argv could be NULL, etc..) could result in an invalid read.
Update the f_console_parameter_process() to verify the argc and argv data (f_console_parameter_process() doesn't utilize envp).
Improve tests to catch these potential problems.
Return F_data_not (without error bit) to represent that there is no argc, argv is NULL, or when argv[0] is NULL.
Change the previous F_data_not return to instead return F_complete_not (without error bit) to represent that all of the expected values were not found.

Update functions to use "const" after the asterisk representing the parameter pointer.
36 files changed:
level_0/f_console/c/console.c
level_0/f_console/c/console.h
level_0/f_console/c/console/common.h
level_0/f_console/data/build/settings-tests
level_0/f_console/tests/unit/c/test-console-environment_process.c [new file with mode: 0644]
level_0/f_console/tests/unit/c/test-console-environment_process.h [new file with mode: 0644]
level_0/f_console/tests/unit/c/test-console-parameter_process.c
level_0/f_console/tests/unit/c/test-console-parameter_process.h
level_0/f_console/tests/unit/c/test-console.c
level_0/f_console/tests/unit/c/test-console.h
level_0/f_string/c/string/common.h
level_0/f_string/c/string/static.c [new file with mode: 0644]
level_0/f_string/c/string/static.h [new file with mode: 0644]
level_3/byte_dump/c/main.c
level_3/control/c/main.c
level_3/controller/c/main.c
level_3/fake/c/main.c
level_3/firewall/c/main.c
level_3/fss_basic_list_read/c/main.c
level_3/fss_basic_list_write/c/main.c
level_3/fss_basic_read/c/main.c
level_3/fss_basic_write/c/main.c
level_3/fss_embedded_list_read/c/main.c
level_3/fss_embedded_list_write/c/main.c
level_3/fss_extended_list_read/c/main.c
level_3/fss_extended_list_write/c/main.c
level_3/fss_extended_read/c/main.c
level_3/fss_extended_write/c/main.c
level_3/fss_identify/c/main.c
level_3/fss_payload_read/c/main.c
level_3/fss_payload_write/c/main.c
level_3/fss_status_code/c/main.c
level_3/iki_read/c/main.c
level_3/iki_write/c/main.c
level_3/status_code/c/main.c
level_3/utf8/c/main.c