Commit Graph

55 Commits

Author SHA1 Message Date
Rose
45fdfa18f1 Mark functions not returning as sudo_noreturn
We also put NOTREACHED where it applies.
2023-07-01 17:40:16 -04:00
Rose
e54ba33ea0 Avoid compiler casting warnings by assigning to the same type where possible
This saves instructions that are related to casting as well as compiler warnings.
2023-06-28 17:25:26 -04:00
Todd C. Miller
86ab362fd4 Move JSON log parsing from libsudo_iolog.la to libsudo_eventlog.la
It will be used in the upcoming log output tests.
2023-03-13 15:02:03 -06:00
Todd C. Miller
6725c37e3c Check for errors when removing the temp directory.
If we cannot remove the directory tree that may indicate a file or
directory mode problem.
2023-01-12 19:20:17 -07:00
Todd C. Miller
6b80ab74ea Decode \u00XX in a JSON string now that we escape control chars.
We don't write Unicode to the log.json file, only 8-bit ASCII.
2023-01-03 15:59:23 -07:00
Todd C. Miller
bfd7d586b5 check_iolog_mkpath: fix exit value 2023-01-03 14:02:23 -07:00
Todd C. Miller
ad55f8ccee Use correct dictionary file format.
Also use the new dictionaries in the Makefile fuzz target.
2022-12-30 11:26:49 -07:00
Todd C. Miller
224a3b6470 Add some addition entries for the I/O log fuzzer seed corpus. 2022-12-30 11:10:40 -07:00
Todd C. Miller
148e5ad95b Add dictionaries for fuzz_iolog_legacy and fuzz_iolog_timing. 2022-12-30 10:52:54 -07:00
Todd C. Miller
91d7592e8a Use initprogname(), not setprogname() in the fuzzers.
This results in better coverage for progname.c.
2022-12-29 15:52:21 -07:00
Todd C. Miller
797cc917a8 Add basic regress for JSON functions.
Fix a bug in escaped control character handling.
Roll back changes to buffer if sudo_json_add_value() fails.
2022-12-15 19:49:11 -07:00
Todd C. Miller
57b5ff8e8c Avoid a -Wshadow warning on Solaris 9. 2022-10-07 11:00:17 -06:00
Todd C. Miller
13672f28df Make sudo pass -Wwrite-strings 2022-06-28 16:33:15 -06:00
Todd C. Miller
f5ac1317c4 Make sudo pass -Wmissing-prototypes 2022-06-27 12:48:03 -06:00
Todd C. Miller
31ab2e2297 Plug a few test memory leaks now that they return from main(). 2022-03-08 13:34:38 -07:00
Todd C. Miller
43cc80d795 Add -v option parsing to regress tests, currently a no-op.
This will be used by a "check-verbose" target in the future.
2022-03-02 11:09:51 -07:00
Todd C. Miller
eaf76278ec Fix compilation on systems without a real openat(2). 2022-02-22 14:13:15 -07:00
Todd C. Miller
41bc52302b Do not disable fuzzer output if SUDO_FUZZ_VERBOSE env variable is set. 2022-02-22 12:04:10 -07:00
Todd C. Miller
cadfbfedb9 Add tests for iolog filtering.
This is the functionality used by the log_passwords and passprompt_regex
options.
2022-02-18 09:40:40 -07:00
Todd C. Miller
f49c7ac5a5 Add new log.json keywords 2021-10-19 13:13:59 -06:00
Todd C. Miller
89b53d5edd fuzz_iolog_json: initialize exit_value to -1 2021-10-19 13:13:29 -06:00
Todd C. Miller
eefb7b0d54 Use a consistent version of fuzz_conversation() with all fuzzers.
Also undo a change to fuzz_sudoers.c that snuck in to the last commit.
2021-09-28 20:20:28 -06:00
Todd C. Miller
7d964875df Fuzzers should not produce output.
Excessive output makes the fuzzer runs much less efficient.
2021-09-28 18:53:49 -06:00
Todd C. Miller
55171df5e5 Check strftime(3) return value in all cases.
Old versions of strftime(3) didn't guarantee to NUL-terminate the buffer
so we explicitly clear the last byte of the buffer and check it.
2021-09-17 14:01:28 -06:00
Todd C. Miller
18f1884ddc Use gmtime_r() and localtime_r() instead of gmtime() and localtime(). 2021-09-17 10:55:06 -06:00
Todd C. Miller
6eff3b313b Move corpus files to a seed subdirectory. 2021-03-18 15:28:29 -06:00
Todd C. Miller
95bfd65fec Flush stdout before successful return from LLVMFuzzerTestOneInput().
Fixes a problem with diag lines from libFuzzer being interspersed
with test output.
2021-03-18 13:08:30 -06:00
Todd C. Miller
851247e58c Split iolog_fileio.c into multiple files. 2021-02-26 21:07:48 -07:00
Todd C. Miller
80e223b6c8 Remove unnecessary warnings, we want to fail silently. 2021-02-25 16:15:47 -07:00
Todd C. Miller
a3f38fac0c Set program name in fuzzers so we get consisten warnings. 2021-02-24 15:14:58 -07:00
Todd C. Miller
a56f7daeea Split iolog_util.c into iolog_loginfo.c and iolog_timing.c.
Also rename check_iolog_util -> check_iolog_timing.
2021-02-24 14:40:33 -07:00
Todd C. Miller
03e610dab5 Strings in dictionary files need to be quoted. 2021-02-23 12:38:02 -07:00
Todd C. Miller
081e219e23 Add dictionary files for fuzzers where possible. 2021-02-23 11:28:47 -07:00
Todd C. Miller
d81d7e0cf2 Fix unlinking of timing temp file. 2021-02-15 13:46:11 -07:00
Todd C. Miller
ea7a70e85d For "make fuzz" only fuzz the seed corpus.
This way we avoid files generated by the fuzzer itself.
2021-02-15 07:35:19 -07:00
Todd C. Miller
30d9497eb6 Add stub library that just feeds files to the fuzzing target.
This will allow the fuzzers to be run as part of "make check".
2021-02-07 15:43:51 -07:00
Todd C. Miller
a72d743ec8 Fall back to a temp file if fmemopen() is not available(). 2021-02-07 13:56:15 -07:00
Todd C. Miller
4480e26972 Build (but don't run) fuzzers as part of "make check".
Uses a stub to make it possible to link w/o libfuzzer.
The goal is to ensure the fuzzers are always buildable and avoid bit rot.
2021-02-06 08:38:38 -07:00
Todd C. Miller
1c02c14c35 Add more test files for fuzzers. 2021-02-05 19:30:00 -07:00
Todd C. Miller
5c2a21350d fuzzer for I/O log timing files 2021-02-04 19:22:15 -07:00
Todd C. Miller
d2901f4121 Add fuzzer for legacy I/O log info file. 2021-02-03 07:41:20 -07:00
Todd C. Miller
20b3904f4f Add missing fclose(3) of fmemopen(3) stream; it does not modify the data. 2021-02-02 13:58:31 -07:00
Todd C. Miller
1e3cecc608 Add initial fuzzers to be used by oss-fuzz.
These are not yet hooked up to the sudo build.
2021-02-01 15:17:57 -07:00
Todd C. Miller
5dc297d300 Fix crash when file does not exist. 2021-01-30 14:04:05 -07:00
Todd C. Miller
985af422d2 Rename __dso_public -> sudo_dso_public and move to config.h. 2020-08-12 09:57:42 -06:00
Todd C. Miller
d4739533fd Add regress test to catch swapids() bug when called by iolog_mkdtemp() 2020-06-18 15:14:00 -06:00
Todd C. Miller
446ae3f507 Include string.h unconditionally and only use strings.h for strn?casecmp()
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800 We no longer need to include headers we don't use for sudo*.h files.
Previously we needed to include headers required by the various
sudo*h files.  Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
83d1bee918 Rename sudo_parse_host_port -> iolog_parse_host_port and mv to lib/iolog
It is not used outside of the I/O log client and server and the
host:port syntax may change in the future.
2020-05-11 08:47:54 -06:00
Todd C. Miller
3cd9cbbadf Add tests for the simple json parser. 2020-03-29 05:05:08 -06:00