Todd C. Miller
cb7b1dd89c
Pass closure to callback, not the callback pointer itself.
2023-03-10 11:19:37 -07:00
bin-ly
ec255dca1e
fix command error for lib/util/Makefile.in
2023-03-09 10:10:45 +08:00
Todd C. Miller
dea110a848
Add tests for SHA2 digest support.
...
This uses the NIST byte-oriented short message test vectors.
2023-03-07 12:45:13 -07:00
Todd C. Miller
0be5a51918
Add missing include of errno.h.
2023-02-23 09:14:28 -07:00
Todd C. Miller
3281d0eec4
sudo_lbuf_expand: check for overflow when rounding to the nearest power of 2.
...
Problem deteced by oss-fuzz using the fuzz_sudoers fuzzer.
2023-02-23 08:19:18 -07:00
Todd C. Miller
8bb1160624
Replace LIBMD with LIBCRYPTO display crypto/tls libs in summary.
...
We can only have one of either -lmd, -lgcrypt or -lcrypto so there
is no need to have more than one variable.
2023-02-22 08:49:33 -07:00
Todd C. Miller
0339337103
Run the editor in its own process group.
...
This fixes suspending the editor on GNU Hurd which doesn't seem to
have proper process group signal handling.
2023-02-21 16:14:14 -07:00
Todd C. Miller
0443d14578
Add checks for realpath(3) and a version from NetBSD for those without it.
2023-02-12 13:27:17 -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
e63eeee7b4
Add debug tracing to tcsetattr_nobg().
2023-02-02 09:31:25 -07:00
Todd C. Miller
6d945448ef
Merge pull request #230 from trackers-lover/main
...
Return value does not match
2023-01-29 07:12:25 -07:00
bianguangze@uniontech.com
8797f0ceb9
Modify return value parameter
2023-01-29 11:08:38 +08:00
Todd C. Miller
e11bb93e26
Add tests for escaped digits.
2023-01-23 08:48:21 -07:00
Todd C. Miller
f6340068d1
check_pattern: handle escaped digits since GNU libc accepts them.
2023-01-23 08:02:25 -07:00
Todd C. Miller
ee2f2287a6
check_pattern: accept a backslash before the numeric bound like glibc.
...
This helps avoid out-of-memory conditions when fuzzing on Linux.
2023-01-19 19:50:09 -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
trackers-love
326f013cfa
Return value does not match
2023-01-17 12:24:45 +08:00
Todd C. Miller
0b2f9cbe7c
In SHA256Pad and SHA512Pad use 511 and 1023 respectively for bitwise AND.
...
Previously we were using 504 and 1016 which still produces the
correct result since padding is done in 8-bit bytes. However, using
size-1 for the bitwise AND makes the intent clearer and likely would
have prevented the previous bug in SHA512Pad.
From Matthieu Barjole and Victor Cutillas of Synacktiv (https://synacktiv.com )
2023-01-09 14:37:47 -07:00
Todd C. Miller
1b7604e5cb
sudo_lbuf_print: no longer need to check for lbuf->len > 0.
...
Now that lbuf length is unsigned the earlier check for len == 0 is
sufficient.
2023-01-09 14:16:59 -07:00
Todd C. Miller
ca297658dd
Increase minimum allocation size from 256 to 1024 bytes.
2023-01-09 14:15:23 -07:00
Todd C. Miller
532023f7b6
sudo_lbuf_expand: don't allocate less than 256 bytes at a time.
2023-01-04 10:36:09 -07:00
Todd C. Miller
dc9ef69021
sudo_lbuf_expand: round nearest power of two instead of multiple of 256.
2023-01-03 21:34:20 -07:00
Todd C. Miller
13df52889f
sudo_lbuf_expand: check for possible integer overflow
...
The numeric fields in struct sudo_lbuf are now unsigned so that
wraparound is defined, this make the overflow checks simpler.
Problem deteced by oss-fuzz using the fuzz_sudoers fuzzer.
2023-01-03 20:02:01 -07:00
Todd C. Miller
e5d98da014
Move hexchar() from the sudoers plugin to lib/util.
2023-01-03 15:50:42 -07:00
Todd C. Miller
0cb3835111
sudo_open_parent_dir: adjust loop terminating condition
...
Checking for ep < pathend should be a bit clearer than ep != '\0'
and has the advantage of working when pathend doesn't point to a
NUL byte. No intended change in behavior.
2023-01-03 15:22:29 -07:00
Todd C. Miller
8b5037a211
glibc allows the ',' in {low,high} to be escaped with a backslash.
...
Adjust bound parsing to match this.
2023-01-01 10:12:09 -07:00
Todd C. Miller
a9a3a8e37b
Back out the genentropy.c portion of c648cfe9ff0f
...
We don't need to special-case FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
now that we use the glibc arc4random() where available.
2022-12-30 08:02:39 -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
2e9e1c80f5
Avoid compiling some code paths that are unreachable when fuzzing.
2022-12-29 10:40:48 -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
97fb4eae72
sudo_dso_load: add AIX fallback path from shlib.so to shlib.a(shlib.so).
...
If the .so file is missing but the .a file exists, try to dlopen()
the AIX .a file using the .so name as the member. We need to avoid
breaking existing configurations if the type of AIX shared library
changes when sudo is upgraded.
2022-12-26 07:43:55 -07:00
Todd C. Miller
49f2d67070
Fix support for AIX-style path(module) syntax in sudo.conf Plugin lines.
2022-12-22 16:45:13 -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
f0530b66d3
Instead of collapsing duplicate repetition characters, reject them.
...
This is implementation-specific behavior--some regcomp(3) will
reject duplicate repetition characters (BSD), others will try to
support them (Glibc) but may allocate excessive amounts of memory.
2022-12-17 11:32:24 -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
e706204f5f
Escape control characters in strings.
2022-12-14 19:08:38 -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
185fe31fea
Fix -Wsign-compare warning.
2022-12-06 18:21:49 -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
ee6420ad5b
Sync with OpenBSD.
2022-12-03 09:04:25 -07:00
Sohom
8ac89f8d05
[snprintf] Check for '\0' to prevent undef memory read
2022-12-03 08:14:14 +05:30
Todd C. Miller
f066ff9e01
Eliminate a few harmless dead stores.
...
Quiets warnings from Infer.
2022-11-22 11:18:24 -07:00
modric
dbfd84301a
sudo_rcstr_dup: Fix potential NULL pointer deref
2022-11-22 10:12:29 +08:00
modric
1eabf13577
sudo_mmap_strdup_v1: Fix potential NULL pointer deref
2022-11-20 20:06:55 +08: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