Commit Graph

106 Commits

Author SHA1 Message Date
Todd C. Miller
e5d98da014 Move hexchar() from the sudoers plugin to lib/util. 2023-01-03 15:50:42 -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
206155e603 Add probe_interfaces and intercept_path. 2022-12-29 15:44:54 -07:00
Todd C. Miller
bd98868518 Exercise getter functions. 2022-12-29 15:44:33 -07:00
Todd C. Miller
ee5b43280b Check for bound values larger than 255 and reject them.
This is to prevent the fuzzers from running out of memory.
2022-12-27 13:22:29 -07:00
Todd C. Miller
50958a05da Remove developer mode from sudo.conf, it is no longer used. 2022-12-26 07:43:55 -07:00
Todd C. Miller
d7b3673933 Add missing sudo_json_free(). 2022-12-17 16:37:29 -07:00
Todd C. Miller
0614c1f626 check_pattern: check bounds as a repetition operator too.
Add regess to verify check_pattern() via sudo_regex_compile().
2022-12-17 15:09:30 -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
a04557c3d4 Fix memory leak in multiarch_test to quiet leak sanitizer. 2022-12-11 13:46:04 -07:00
Todd C. Miller
7e20e4b80f Apply multiarch rules when loading plugins too. 2022-10-06 12:46:38 -06:00
Todd C. Miller
b37bf44cdd Add test for sudo open_parent_dir() 2022-10-05 12:36:14 -06:00
Todd C. Miller
f6e4d2765a Add explicit include of unistd.h for getopt(3) and related variables. 2022-07-05 11:35:25 -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
51b64780c0 Plug a memory leak. 2022-06-01 15:24:28 -06:00
Todd C. Miller
b2a32f95ee getdelim_test: increase longstr to check end pointer after realloc
This would have caught the recent bug in our getdelim replacement
when run under address-sanitizer or valgrind.
2022-03-11 09:03:55 -07: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
75a0e51590 Add sudo_closefrom() regression test. 2022-03-01 11:31:19 -07:00
Todd C. Miller
c2bd52edf8 Allow test harness to be run from any directory.
Also add missing copyright notice.
2022-02-28 19:39:33 -07:00
Todd C. Miller
a4f847b1d6 Adapt test harness for lib/util and move to regress directory. 2022-02-28 19:23:41 -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
Larkin Nickle
07bdfeedb8 Define MAP_FAILED where relevant if undefined
On systems such as HP-UX 10.20, MAP_FAILED is not
defined.
2021-10-21 19:16:28 -04: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
4bff82cab4 Fix random uuid generation, no need to convert between byte order.
Also add regression test.
2021-08-31 19:53:28 -06:00
Todd C. Miller
cc3b4ffb04 Remove vsyslog(3) emulation, it is no longer used. 2021-06-14 13:11:39 -06:00
Todd C. Miller
dfaa9b95f1 Add getgids utility to simular "id -G" using sudo_getgrouplist2() 2021-06-07 14:18:09 -06:00
Todd C. Miller
468e9c7f48 Awful hack to pass on macOS where group_source=dynamic by default. 2021-05-04 13:58:29 -06:00
Todd C. Miller
ac878d3e27 Quiet clang analyzer false positive in regress tests. 2021-04-27 15:56:24 -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
a3f38fac0c Set program name in fuzzers so we get consisten warnings. 2021-02-24 15:14:58 -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
a7e2dd15e1 Test the error case by closing the underlying fd.
Note that we don't use ferror() here since our getdelim() has no
way to set the error flag if there is a memory allocation error.
2021-02-18 13:15:35 -07:00
Todd C. Miller
db70a70d07 Test the case where getdelim() must reallocate the buffer.
Reproduces Bug #960.
2021-02-18 10:42:04 -07:00
Todd C. Miller
25f50e2f07 Add simple fuzzer for sudo.conf parser. 2021-02-15 13:17:26 -07:00
Todd C. Miller
0663ffbc3f Use sudo_basename() instead of doing the equivalent manually. 2021-02-10 15:14:08 -07:00
Todd C. Miller
e0c2635fb3 Apply Google inclusive language guidelines.
Also replace backwards with backward.
2020-10-30 10:15:30 -06:00
Todd C. Miller
84e6e6ccf9 Update copyright year on some files where it was out of date. 2020-08-31 14:09:36 -06:00
Todd C. Miller
cbad17a994 Move inclusion of compat headers up with the system headers.
Now that sudo_dso_public is defined in config.h we don't need sudo_compat.h
before including the compat headers.
2020-08-12 10:07:07 -06: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
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
0cf2e09e0c Apply spelling fixes.
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -06:00
Todd C. Miller
b5a317aeb9 Add support for a tls flag in sudo_parse_host_port().
If the string "(tls)" appears at the end, the tls flag is set to true
and the default tls port is used if necessary.
2020-05-05 13:23:26 -06:00
Todd C. Miller
ac61b5655d Use EXIT_SUCCESS and EXIT_FAILURE more consistently. 2020-02-08 12:43:00 -07:00