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
2f4b406809
iolog_gets: change size parameter to int to match fgets/gzgets
...
Return an error, setting errno to EINVAL, for negative sizes.
2023-05-05 10:20:21 -06:00
Todd C. Miller
3f5e7df3cd
Add lib dependencies for fuzzer and test targets.
2023-03-15 13:13:38 -06:00
Todd C. Miller
027b42d5a6
Fix static compilation.
2023-03-14 13:27:45 -06: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
2845ceafb0
Handle "locale -a" returning both C.UTF-8 and C.utf8.
...
It is possible to have mutiple matches from the output of "locale
-a". Just take the first one. Fixes GitHub issue #241 .
2023-02-15 13:49:04 -07:00
Todd C. Miller
334daf92b3
Escape control characters in log messages and "sudoreplay -l" output.
...
The log message contains user-controlled strings that could include
things like terminal control characters. Space characters in the
command path are now also escaped.
Command line arguments that contain spaces are surrounded with
single quotes and any literal single quote or backslash characters
are escaped with a backslash. This makes it possible to distinguish
multiple command line arguments from a single argument that contains
spaces.
Issue found by Matthieu Barjole and Victor Cutillas of Synacktiv
(https://synacktiv.com ).
2023-01-18 08:21:34 -07: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
8d7feb76ed
iolog_mkdtemp: fix pasto in last commit
...
Set mode to iolog_dirmode, not iolog_filemode
2023-01-12 19:15:22 -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
311d8e82df
iolog_mkdtemp: fix failure when the specified path contains subdirectories.
...
This fixes a bug introduced in sudo 1.9.12.
2023-01-03 14:30:48 -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
3df7b64d80
Fix failure in check targets when there is no UTF-8 C locale.
2022-12-06 16:26:34 -07:00
Todd C. Miller
5683fc6f7a
The name of the C locale w/ UTF-8 support is not always C.UTF-8.
...
Use a pattern to find it (if present) and use that value instead
of hard-coding C.UTF-8. This works around a leak sanitizer crash
on certain inputs.
2022-11-11 07:05:21 -07:00
Todd C. Miller
7ba3184708
Include time.h for struct timespec used by sudo_iolog.h.
2022-11-03 14:39:33 -06:00
Todd C. Miller
57b5ff8e8c
Avoid a -Wshadow warning on Solaris 9.
2022-10-07 11:00:17 -06:00
Todd C. Miller
59765dd360
Correct return value when mkdtempat() fails.
2022-10-04 09:01:44 -06:00
Todd C. Miller
9d654482b2
Convert remaining uses of sudo_mkdir_parents() to sudo_open_parent_dir().
2022-09-21 19:08:15 -06:00
Todd C. Miller
a326411903
Use $(GREP) and $(EGREP) variables in Makefile.in files.
2022-09-12 16:30:52 -06:00
Li zeming
393d9997cb
iolog/hostcheck: These two parameters do not need to be initialized and assigned, the following code is directly assigned
...
Signed-off-by: Li zeming <zeming@nfschina.com >
2022-08-02 13:39:48 -06:00
Todd C. Miller
5f534979ef
Regenerate dependencies
2022-06-29 10:18:56 -06:00
Todd C. Miller
3e21c8da5c
Add missing PVS Studio Open Source comments.
...
Also avoid checking protobuf-c source and protobuf-c generated files.
2022-06-29 09:45:04 -06:00
Todd C. Miller
e5834bd405
Use #include <config.h> not #include "config.h" for consistency.
...
Otherwise, some compilers may do the wrong thing in a build
dir if there is a config.h file in the source dir too.
2022-06-29 08:47:16 -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
583e8bf538
Use explicit library dependencies instead of implicit.
...
We now include all the dependent libraries when linking.
Fixes a linking problem on CentOS Stream 9.
2022-05-19 17:01:14 -06:00
Todd C. Miller
dcb2fb26a5
Rename SSP_(C|LD)FLAGS -> HARDENING_(C|LD)FLAGS
2022-04-01 11:14:59 -06:00
Todd C. Miller
1f64aca229
Unset LANGUAGE when running tests, otherwise it may override LC_ALL.
...
Bug #1025 .
2022-03-14 13:51: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
c131b27474
For 'make check-verbose' run fuzzers with -verbose=1
...
This is the default for libFuzzer but not for the stub fuzzer lib.
2022-03-03 10:45:56 -07:00
Todd C. Miller
cdee5d48da
Add check-verbose Makefile target that runs tests in verbose mode.
2022-03-02 13:32:08 -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
b19bd98531
iolog_pwfilt_run: apply regex on ttyout even if we disabled filtering.
...
The heuristic used to decide when to disable filtering is when we
see another ttyout buffer or find a cr or nl in the ttyin buffer.
However, we should also check the buffer that caused us to disable
filtering for a matching regex that would re-enable filtering.
Programs that prompt for a password twice might otherwise not have
the second password filtered.
2022-02-18 09:14:35 -07:00
Todd C. Miller
7c17f84a35
Add helper function to compile a regex that supports (?i).
2022-02-11 12:01:31 -07:00
Todd C. Miller
b6a2fcf59f
iolog_pwfilt_run: fix types in error return
2022-02-10 09:43:33 -07:00
Todd C. Miller
c5027c796c
Free potential leaks of passprompt_regex_handle.
...
Coverity CID 249057
2022-02-10 09:08:31 -07:00
Todd C. Miller
6564f1ae4c
Work around a glibc regcomp() bug with repeated '+' operators.
...
Glibc regcomp() has a bug where it uses excessive memory for repeated
'+' ops. Collapse them to avoid running the fuzzer out of memory.
2022-02-01 13:12:19 -07:00
Todd C. Miller
946404434e
lib/iolog: add support for filtering password out of tty input
...
If a password regex is found in the tty output, tty input will be
replaced with '*' chars until a newline or another tty output
character is received.
2022-01-28 08:52:41 -07:00
Todd C. Miller
763256e464
Improve debugging info when fdopen() fails.
2022-01-07 12:49:30 -07:00
Todd C. Miller
09b82a22ca
Add configure check for sha1sum and use "openssh dgst -sha1" if missing.
...
Only needed when building the seed corpus zip files.
2021-11-10 13:31:42 -07:00
Todd C. Miller
cc6157d7d4
Add support for WolfSSL's OpenSSL compatibility layer.
...
Based on changes from Hayden Roche
2021-10-25 13:17:57 -06:00