]> Kevux Git Server - fll/commit
Security: Invalid reads, always add NULL for compatibility.
authorKevin Day <thekevinday@gmail.com>
Sat, 19 Feb 2022 02:10:16 +0000 (20:10 -0600)
committerKevin Day <thekevinday@gmail.com>
Sat, 19 Feb 2022 02:10:16 +0000 (20:10 -0600)
commit11ac81ccd7fd85fc54c8d6115d705a00a9c266c5
tree6a3becc426a3c3d98b2cd18b6bf4bb899c961616
parentad662162c06edc7a50952e91aeb72de651c901a7
Security: Invalid reads, always add NULL for compatibility.

After switching from f_string_t to f_string_static_t, the NULL terminated string problem has become apparent.
If at any point in time these strings are passed to a standard function that expects NULL terminated strings, then an invalid read (or write) can occur.

Manually appending a NULL termination every time its needed has made the code messier than I would like.
This commit changes the behavior to instead always append a NULL termination after the string.used when appending strings.
I accept the additional resource cost of 1-byte per string to guarantee this.

This should make the program more easily more secure by catering to the NULL terminated string code out there.
This project still doesn't need the or care about NULL termination for most (but not all) of its functions.
41 files changed:
level_0/f_string/c/private-string.c
level_1/fl_environment/c/environment.c
level_1/fl_environment/c/environment.h
level_2/fll_execute/c/execute.c
level_2/fll_execute/c/execute.h
level_2/fll_execute/c/private-execute.c
level_2/fll_execute/c/private-execute.h
level_2/fll_fss/c/fss.c
level_2/fll_path/c/path.c
level_2/fll_path/c/path.h
level_3/control/c/private-control.c
level_3/control/c/private-control.h
level_3/controller/c/common/private-common.c
level_3/controller/c/common/private-common.h
level_3/controller/c/controller.c
level_3/controller/c/controller/private-controller.c
level_3/controller/c/controller/private-controller.h
level_3/controller/c/entry/private-entry.c
level_3/controller/c/entry/private-entry.h
level_3/controller/c/entry/private-entry_print.c
level_3/controller/c/process/private-process.c
level_3/controller/c/process/private-process.h
level_3/controller/c/rule/private-rule.c
level_3/controller/c/rule/private-rule.h
level_3/fake/c/private-build-library.c
level_3/fake/c/private-build-load.c
level_3/fake/c/private-build-load.h
level_3/fake/c/private-build-objects.c
level_3/fake/c/private-build.c
level_3/fake/c/private-fake-path_generate.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-make-load_fakefile.c
level_3/fake/c/private-make-load_fakefile.h
level_3/fake/c/private-make-operate.c
level_3/fake/c/private-make-operate.h
level_3/fake/c/private-make-operate_process.c
level_3/fake/c/private-make-operate_process.h
level_3/fake/c/private-make-operate_process_type.c
level_3/fake/c/private-make-operate_process_type.h
level_3/firewall/c/firewall.c
level_3/firewall/c/private-firewall.c