Commit Graph

899 Commits

Author SHA1 Message Date
Todd C. Miller
034b2f3bdd Add testsudoers_setshellfile() and use it in testsudoers. 2023-09-10 16:38:53 -06:00
Todd C. Miller
166ef55aa7 Remove unnecessary sudo_gettext.h include and add missing const. 2023-09-10 10:23:04 -06:00
Todd C. Miller
df969d30b4 Silence a few remaining -Wconversion warnings. 2023-08-23 14:56:50 -06:00
Todd C. Miller
df730dec5d Suppress some other PVS-Studio false positives. 2023-08-21 13:21:49 -06:00
Todd C. Miller
46e6955ba6 Eliminate some clang analyzer false positives. 2023-08-21 10:47:32 -06:00
Todd C. Miller
902453a829 Update embedded copy of zlib to version 1.3. 2023-08-18 11:26:27 -06:00
Todd C. Miller
811051d32a Use int, not short for events in the event API.
This fixes some -Wconversion warnings and fixes an inconsistency
between the libsudo_util event API and the plugin event API.  The
actual struct internals still use shorts to avoid changing the ABI.
2023-08-09 13:22:12 -06:00
Todd C. Miller
0b03511b85 Log source in JSON logs
This makes it possible to tell which rule resulted in a match.
2023-08-08 09:56:19 -06:00
Todd C. Miller
1e6c5f3e79 Fix checking of SSL_{read,write}_ex() return value.
These have a boolean-style return value.  However, our emulated
versions can return -1 on error, which we need to preserve for older
versions of SSL_get_error() which expect it.
2023-08-08 10:18:57 -06:00
Todd C. Miller
5f2a0a70e5 Fix printf format string mismatch now that 'i' is size_t. 2023-08-07 11:31:04 -06:00
Todd C. Miller
77f94f291a sudo_digest_getlen: return size_t, and 0 on error instead of -1
This is an API change, sudo_digest_getlen_v1 remains for binary
compatibility.
2023-08-07 08:43:13 -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
d6d467b92e Add implementation of SSL_read_ex/SSL_write_ex for those without. 2023-08-05 10:38:02 -06:00
Todd C. Miller
7cb1f7f3a9 Cast TIOCSWINSZ to int to avoid overflow warning on 64-bit AIX. 2023-07-31 09:58:13 -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
4b5480cf76 Quiet a warning false positive with older versions of gcc. 2023-07-17 11:23:04 -06:00
Todd C. Miller
625653de08 sudo_term_raw: change the isig argument into a flags field
There are current two flags: SUDO_TERM_ISIG (enable terminal signals)
and SUDO_TERM_OFLAG (preserve output flags).
2023-07-14 13:12:51 -06:00
Todd C. Miller
a432aed4f0 realpath.c: include limits.h and use sysconf(_SC_SYMLOOP_MAX)
This is more portable and eliminates the need to check for SYMLOOP_MAX
(and provide it if missing) in configure.  Also quiet some -Wconversion
warnings.
2023-07-10 15:52:16 -06:00
Todd C. Miller
db6baf2caf Convert sudo_debug_enter and sudo_debug_exit into macros.
In most cases, these simply expand to a call to sudo_debug_printf2().
We need to keep the function versions around in libsudo_util for
backwards compatibility.
2023-07-10 14:30:38 -06:00
Todd C. Miller
2d12a41940 Fix sudo_debug_exit_uint_v1 declaration for fuzzers. 2023-07-10 11:27:28 -06:00
Todd C. Miller
eff4e1c0c5 Add missing sudo_debug_exit_uint_v1 stub for fuzzers. 2023-07-10 11:23:06 -06:00
Todd C. Miller
4f097eebd3 libsudo_util: make more bit flags unsigned. 2023-07-10 11:06:04 -06:00
Rose
5d758264ab Give every printf-like function restrict qualifiers
The format value has to be a string literal, every time.

Otherwise, you are not using these functions correctly. To reinforce this fact, I putrestrict over every non-contrib example of this I could find.
2023-07-07 20:23:20 -04:00
Todd C. Miller
6734a99f8a libiolog: silence -Wconversion warnings. 2023-07-07 15:07:04 -06:00
Todd C. Miller
e93913e2bb libfuzzstub: silence -Wconversion warnings. 2023-07-07 15:07:04 -06:00
Todd C. Miller
c95423a8f9 libevent: silence -Wconversion warnings. 2023-07-07 15:07:04 -06:00
Todd C. Miller
5768d374cc libsudo_util: silence most -Wconversion warnings. 2023-07-07 15:07:04 -06:00
Todd C. Miller
bced0a7786 Make the remaining instances of digest_type unsigned. 2023-07-06 08:01:15 -06:00
Todd C. Miller
17c09dfd27 Remove regress corpus directories correctly 2023-07-05 10:51:23 -06:00
Todd C. Miller
2d1b3c369f Change sudo_strtomode() to return mode_t. 2023-07-05 09:54:22 -06:00
Todd C. Miller
1f0f6b7c78 Fix some indentation. 2023-07-04 18:03:47 -06:00
Todd C. Miller
bfb6132d9c Add configure tests for __builtin_clz/__builtin_clzl 2023-07-04 12:39:31 -06:00
Todd C. Miller
0f69939d71 Add fallback for compilers without __builtin_clz/__builtin_clzl 2023-07-04 12:29:52 -06:00
Todd C. Miller
3a7ca0a834 sudo_pow2_roundup: fix 64-bit version when shifting 31 or more places
Shift 1UL instead of 1 to avoid overflowing an int.
2023-07-04 08:21:21 -06:00
Rose
8c3e4a33cd Optimize sudo_pow2_roundup_v1
No need to call sudo_pow2_roundup_v2.
2023-07-03 22:32:02 -04:00
Todd C. Miller
fa69ee5e1b Merge pull request #285 from AtariDreams/bug
Remove comment about algorithm being from bit-twiddling hacks
2023-07-03 20:26:20 -06:00
Rose
76d7aefb33 Remove comment about algorithm being from bit-twiddling hacks
Said comment no longer applies.
2023-07-03 22:24:55 -04:00
Rose
732110428e Fix fuzzing errors
We should be checking for integer overflow, rather than checking if size is 0.

Additionally, we should set errno to ENOMEM when this overflow happens.

Finally, the most efficient implementation of the round-up-to-2 algorithm involves the clz intrinsic.
2023-07-03 22:20:05 -04:00
Todd C. Miller
f5eb1e0550 sudo_lbuf_expand: limit allocation to UINT_MAX 2023-07-03 19:46:37 -06:00
Todd C. Miller
d3dc70ab62 sudo_parseln: use sudo_pow2_roundup() instead of hand-rolling it. 2023-07-03 17:17:47 -06:00
Todd C. Miller
56a431f7ea Make sudo_pow2_roundup() operate on size_t. 2023-07-03 16:51:05 -06:00
Todd C. Miller
b926df1df2 Make the debug subsystem unsigned.
It was already unsigned in sudoers but not in the front-end or the
python plugin.  Making this consistent resolves a lot of -Wconversion
warnings.  Also clean up some other -Wconversion warnings in sudo_debug.c.
2023-07-01 16:14:50 -06:00
Todd C. Miller
04c7e910ef Fix up indentation. 2023-07-01 16:03:33 -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
22079c3072 Avoid compiler casting warnings Part 2
This saves instructions that are related to casting as well as compiler warnings.
2023-06-29 13:10:27 -04:00
Todd C. Miller
1ba61cd13a No need to round up to page size with sudo_mmap_alloc(). 2023-06-29 10:17:39 -06: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
Rose
7fd680c983 Do variable length arrays the C99 way
Variable length arrays are supported by C99, but having it denoted as "1" confused the compiler and is not defined.

Note that because we don't get the inferred NULL terminator, we have to increase the malloc size by one.
2023-06-15 15:25:17 -04:00
Todd C. Miller
8fbdd414ce Avoid use of variable length arrays and add ctype(3) casts. 2023-06-10 10:48:53 -06:00