Todd C. Miller
1398289fab
Add casts when storing values in a struct timespec.
...
Fixes -Wconversion warnings on some 32-bit systems where time_t is
still 32-bit.
2023-09-27 15:11:10 -06:00
Todd C. Miller
e343e07543
Use #include <foo.h> instead of #include "foo.h" in most cases.
...
We rely on the include path to find many of these headers. It
especially doesn't make sense to use #include "foo.h" for headers
in the top-level include directory.
2023-09-25 10:13:28 -06:00
Todd C. Miller
d53bbb54b2
Add macros to determine the length of an integer type in string form.
...
Adapted from answer #6 in:
https://stackoverflow.com/questions/10536207/ansi-c-maximum-number-of-characters-printing-a-decimal-int
2023-09-19 15:15:02 -06:00
Todd C. Miller
df730dec5d
Suppress some other PVS-Studio false positives.
2023-08-21 13:21:49 -06:00
Todd C. Miller
e5f2354c85
Move compat definition of ASN1_STRING_get0_data to hostcheck.c.
...
It is not used anywhere else.
2023-08-06 14:26:24 -06:00
Todd C. Miller
432ac12128
Pass TEST_VERBOSE to all test programs.
2023-07-20 10:13:40 -06:00
Todd C. Miller
7499b2d274
All test programs should accept the -v option, even if it is ignored.
2023-07-20 10:10:05 -06:00
Todd C. Miller
6734a99f8a
libiolog: silence -Wconversion warnings.
2023-07-07 15:07:04 -06:00
Todd C. Miller
17c09dfd27
Remove regress corpus directories correctly
2023-07-05 10:51:23 -06:00
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