Todd C. Miller
978aa90021
No longer need to set AI_NUMERICSERV while fuzzing.
...
Now that getaddrinfo() is stubbed out while fuzzing we can remove
the hack that set AI_NUMERICSERV.
2023-04-28 13:26:53 -06:00
Todd C. Miller
d1f2452c08
getaddrinfo stub: set sin_port
2023-04-26 16:27:34 -06:00
Todd C. Miller
2898c85119
Avoid NULL deref in stub getaddrinfo() when nodename is NULL.
...
Also add support for parsing servname. We only need to support a
subset of getaddrinfo() functionality in the fuzzer.
2023-04-26 13:23:31 -06:00
Todd C. Miller
47ae92d034
Include arpa/inet.h for inet_pton() prototype.
2023-04-25 13:22:02 -06:00
Todd C. Miller
3d4dc19ecd
Add netdb.h for struct addrinfo and EAI_* error codes.
2023-04-25 13:15:55 -06:00
Todd C. Miller
64f6d6fdbc
Stub out getaddrinfo() and freeaddrinfo().
...
We may not be able have access to DNS in the fuzzing environment.
2023-04-25 13:06:24 -06:00
Todd C. Miller
b013711e48
Check for sudo_pow2_roundup() overflow.
...
Calling sudo_pow2_roundup(INT_MAX+2) will return since there is no
power of 2 larger than INT_MAX+1 that fits in an unsigned int.
This is not an issue in practice since we restrict messages to 2Mib.
2023-03-01 13:58:32 -07: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
4f50692acc
Add some missing files to the clean and distclean targets.
2023-02-15 10:22:42 -07:00
Todd C. Miller
0b2e662b2e
Protect use of AF_INET6 with HAVE_STRUCT_IN6_ADDR guards.
...
From Tim Rice.
2023-01-31 12:22:47 -07:00
Todd C. Miller
49df977c2f
Avoid DNS lookups when fuzzing.
2023-01-31 08:59:50 -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
a0d9963fe6
journal_fdopen: free journal_path and close journal before setting
...
Fixes a potential resource leak that currently cannot happen.
Quiets a warning from Infer.
2022-11-22 11:15:21 -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
57b5ff8e8c
Avoid a -Wshadow warning on Solaris 9.
2022-10-07 11:00:17 -06:00
Todd C. Miller
166e0e13bc
Change max user-ID and group-ID from INT_MAX to UINT_MAX.
2022-09-28 09:06:32 -06:00
Todd C. Miller
865d3cd0bb
Add support for NumberList stored in an InfoMessage.
2022-09-28 09:05:29 -06:00
Todd C. Miller
e6f2ad0ed6
Add missing NULL checks for mandatory fields in protobuf messages.
...
Also no longer reject an InfoMessage with an unknown value_case,
just log and ignore it.
2022-09-28 08:47:25 -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
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
b6151781ce
Quiet some harmless PVS Studio warnings.
2022-06-29 10:08:55 -06:00
Todd C. Miller
54ed54d94e
Use "unable to allocate memory" warning on malloc failure.
...
This is consistent with the rest of the sudo source code.
2022-06-29 10:00:03 -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
161b01fccd
Treat EINTR in a callback like we do EAGAIN.
...
We shouldn't get EINTR in practice since we set SA_RESTART when
registering signal handlers but it doesn't hurt to be consistent.
2022-06-07 09:25:07 -06:00
Todd C. Miller
db6fc237c4
If write(2) returns EAGAIN just re-enter the event loop.
...
This is consistent with how we handle EAGAIN for read(2).
2022-06-06 19:42:06 -06:00
Todd C. Miller
aee276ea63
Quiet two clang analyzer false positives.
2022-06-03 11:05:34 -06:00
Todd C. Miller
5012c7f978
union sockaddr_union: pass in sockaddr_union * instead of sockaddr *.
...
This eliminates the need for a few casts and is consistent with how
create_listener() is written.
2022-06-03 10:11:37 -06:00
Todd C. Miller
2d6b9d22e1
For logsrvd_conf_test include both tls and non-tls configs.
2022-06-02 11:38:43 -06:00
Todd C. Miller
d7b2ff3214
Add a simple regression test for logsrvd.conf parser.
...
Unlike the parser fuzzer, this includes sample certs and keys.
This test would have detected the BIO_new_file() bug in set_dhparams().
2022-06-02 11:13:18 -06:00
Todd C. Miller
0ca222aa88
Fix inverted logic when setting server_log.
...
A value that starts with a '/' should be treated as a path.
2022-06-02 10:59:30 -06:00
Todd C. Miller
15f167c3a0
Fix uninitialized use of ca_store when building with wolfSSL.
2022-05-27 11:23:45 -06:00
Todd C. Miller
38c6e1bffb
Standardize protobuf "unable to unpack" warning messages.
2022-05-26 09:35:18 -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
69fa04f069
Include the cert or ca file in error messages where applicable.
2022-05-17 10:44:18 -06:00
Todd C. Miller
a82fe9aa06
Add missing include of string.h for strerror(3).
2022-05-17 09:31:22 -06:00
Todd C. Miller
d7df7abf87
If ERR_reason_error_string() returns NULL, fall back on strerror(errno).
...
That way we get reasonable error messages for missing files, etc.
2022-05-17 09:18:03 -06:00
Todd C. Miller
3ba807b70f
set_dhparams: pass BIO_new_file() "r" for the file mode, not O_RDONLY.
...
Unlike BIO_new_fp(), BIO_new_file() takes an fopen-style mode string.
2022-05-17 08:38:49 -06:00
Todd C. Miller
c7ed03c986
sudo_logsrvd: update elapsed time for winsize and suspend in journal mode
...
Fixes a bug in store-first relay mode where the commit point messages
sent by the server were incorrect.
2022-04-24 17:26:05 -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
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
e703feeae2
sudo_regex_compile_v1 stub: set errstr on error
2022-02-25 14:07:22 -07:00
Todd C. Miller
590c4cf62f
fuzz_logsrvd_conf: add stub version of sudo_regex_compile_v1().
...
We want to fuzz our parser, not the libc regular expression code.
2022-02-25 10:13:34 -07:00