Todd C. Miller
abdef93f72
Remove duplicated MALLOC_OPTIONS and MALLOC_CONF env variables.
2021-02-17 13:06:35 -07:00
Todd C. Miller
dc45ac5bc7
On parse error, display line and column instead of the offending line.
2021-02-17 11:29:08 -07:00
Todd C. Miller
4a279d5767
Pass I/O log memory allocation errors up to the caller.
2021-02-16 16:55:25 -07:00
Todd C. Miller
a18b2a9ddf
Limit max_groups in sudo.conf to 1024.
...
The max_groups setting should no longer be needed anyway.
2021-02-16 12:37:23 -07:00
Todd C. Miller
25f50e2f07
Add simple fuzzer for sudo.conf parser.
2021-02-15 13:17:26 -07:00
Todd C. Miller
d81d7e0cf2
Fix unlinking of timing temp file.
2021-02-15 13:46:11 -07:00
Todd C. Miller
de2a47f273
Set MALLOC_OPTIONS and MALLOC_CONF for all regress targets.
2021-02-15 13:17:46 -07:00
Todd C. Miller
ea7a70e85d
For "make fuzz" only fuzz the seed corpus.
...
This way we avoid files generated by the fuzzer itself.
2021-02-15 07:35:19 -07:00
Todd C. Miller
eedc72d7b9
Make fuzz targets depend on fuzzer stub library.
...
We really want a dependency on $(LIB_FUZZING_ENGINE) but that could
be a flag like "-fsanitize=fuzzer" instead of a path.
2021-02-12 15:35:18 -07:00
Todd C. Miller
a9f204aef8
regen
2021-02-12 15:31:26 -07:00
Todd C. Miller
53e3dca7a6
Fix up some .la file library dependencies.
...
libsudo_iolog.la already depends on libsudo_util.la and libsudo_eventlog.la
so we don't need to list those explicitly when libsudo_iolog.la is listed.
2021-02-10 16:47:38 -07:00
Todd C. Miller
0663ffbc3f
Use sudo_basename() instead of doing the equivalent manually.
2021-02-10 15:14:08 -07:00
Todd C. Miller
41fa461fe1
Add a GNU-compatible version of basename(3).
...
Unlike POSIX basename(3), the GNU variant does not modify its argument.
Note that basename of a path ending in "/" returns an empty string.
2021-02-10 14:26:26 -07:00
Todd C. Miller
bbfd430cf9
feof(3) returns non-zero at EOF, not necessarily 1.
...
On Illumos at least it returns a value other than 1.
2021-02-09 18:25:03 -07:00
Todd C. Miller
91351d57f4
Suppress PVS Studio false positives.
2021-02-08 16:31:03 -07:00
Todd C. Miller
722759d0b9
Fix CID 217123, size check always false on 64-bit systems.
2021-02-08 15:57:19 -07:00
Todd C. Miller
63a3f62547
Add fuzz Makefile target and run fuzzer corpus in make check.
2021-02-08 04:56:17 -07:00
Todd C. Miller
30d9497eb6
Add stub library that just feeds files to the fuzzing target.
...
This will allow the fuzzers to be run as part of "make check".
2021-02-07 15:43:51 -07:00
Todd C. Miller
a72d743ec8
Fall back to a temp file if fmemopen() is not available().
2021-02-07 13:56:15 -07:00
Todd C. Miller
c140b5942c
Remove remnants of liblogsrv.
2021-02-07 08:58:41 -07:00
Todd C. Miller
55df5efdce
Add --enable-fuzzer-linker and --enable-fuzzer-engine options.
...
These will allow the fuzzers to be built as part of oss-fuzz.
2021-02-07 05:52:45 -07:00
Todd C. Miller
6216fb3cca
Add --enable-fuzzer option to use when building fuzzers
2021-02-06 13:28:39 -07:00
Todd C. Miller
4480e26972
Build (but don't run) fuzzers as part of "make check".
...
Uses a stub to make it possible to link w/o libfuzzer.
The goal is to ensure the fuzzers are always buildable and avoid bit rot.
2021-02-06 08:38:38 -07:00
Todd C. Miller
ecaa9cd08d
Add libsudo_eventlog.la as a dependency of libsudo_iolog.la
...
No longer need to link against libsudo_eventlog.la in sudoers.
2021-02-06 08:36:01 -07:00
Todd C. Miller
1c02c14c35
Add more test files for fuzzers.
2021-02-05 19:30:00 -07:00
Todd C. Miller
5c2a21350d
fuzzer for I/O log timing files
2021-02-04 19:22:15 -07:00
Todd C. Miller
47f08e986f
In JSON, name/value pairs must be separated by a comma.
...
Previously we didn't require the comma to be there.
2021-02-04 18:01:53 -07:00
Todd C. Miller
92cf172eda
Detect integer overflow when converting JSON_ARRAY to string vector.
...
Extremely unlikely to happen but better safe than sorry.
2021-02-04 16:10:35 -07:00
Todd C. Miller
d2901f4121
Add fuzzer for legacy I/O log info file.
2021-02-03 07:41:20 -07:00
Todd C. Miller
20b3904f4f
Add missing fclose(3) of fmemopen(3) stream; it does not modify the data.
2021-02-02 13:58:31 -07:00
Todd C. Miller
2fd4a2ad71
Check for unexpected value after checking the name, not before.
2021-02-02 13:32:29 -07:00
Todd C. Miller
71997da168
Fix potential leak of evlog->runuser.
...
Also warn if we find an unexpected JSON type.
2021-02-02 10:27:27 -07:00
Todd C. Miller
eec4f42366
Allow getprogname() to succeed as long as __progname is present.
...
Also simplify the progname code so we only need a single implementation.
2021-02-02 11:20:53 -07:00
Todd C. Miller
1e3cecc608
Add initial fuzzers to be used by oss-fuzz.
...
These are not yet hooked up to the sudo build.
2021-02-01 15:17:57 -07:00
Todd C. Miller
4cd6350cad
Fix crashes trying to parse invalid JSON.
...
Found locally using libfuzzer/oss-fuzz.
2021-01-30 16:16:23 -07:00
Todd C. Miller
de82d08e70
Plug memory leak if a key is listed more than once in the log.json file.
2021-01-30 16:15:24 -07:00
Todd C. Miller
5dc297d300
Fix crash when file does not exist.
2021-01-30 14:04:05 -07:00
Todd C. Miller
8781560e1b
In json_stack_push() treat stack exhaustion like memory allocation failure.
...
Return NULL instead of treating as a fatal error.
This should make life a little easier for oss-fuzz.
2021-01-29 09:23:51 -07:00
Fabrice Fontaine
c05fe93669
lib/eventlog/Makefile.in: fix static build without closefrom
...
Since version 1.9.4 and
bd1ca79cca
,
when closefrom is not available, libsudo_eventlog.a depends on
libsudo_util.a. So reflect this dependency in the libtool file to avoid
the following static build failure of logsrvd:
/bin/bash ../libtool --tag=disable-static --mode=link /home/buildroot/autobuild/instance-1/output-1/host/bin/powerpc-linux-gcc -o sudo_logsrvd logsrv_util.o iolog_writer.o logsrvd.o logsrvd_conf.o -static -Wl,--enable-new-dtags -Wl,-z,relro ../lib/iolog/libsudo_iolog.la ../lib/eventlog/libsudo_eventlog.la ../lib/logsrv/liblogsrv.la
/bin/bash ../libtool --tag=disable-static --mode=link /home/buildroot/autobuild/instance-1/output-1/host/bin/powerpc-linux-gcc -o sudo_sendlog logsrv_util.o sendlog.o -static -Wl,--enable-new-dtags -Wl,-z,relro ../lib/iolog/libsudo_iolog.la ../lib/eventlog/libsudo_eventlog.la ../lib/logsrv/liblogsrv.la
libtool: link: /home/buildroot/autobuild/instance-1/output-1/host/bin/powerpc-linux-gcc -o sudo_logsrvd logsrv_util.o iolog_writer.o logsrvd.o logsrvd_conf.o -static -Wl,--enable-new-dtags -Wl,-z -Wl,relro ../lib/iolog/.libs/libsudo_iolog.a /home/buildroot/autobuild/instance-1/output-1/build/sudo-1.9.5p1/lib/util/.libs/libsudo_util.a -lpthread -lz ../lib/eventlog/.libs/libsudo_eventlog.a ../lib/logsrv/.libs/liblogsrv.a
/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc-buildroot-linux-uclibc/8.3.0/../../../../powerpc-buildroot-linux-uclibc/bin/ld: ../lib/eventlog/.libs/libsudo_eventlog.a(eventlog.o): in function `send_mail.constprop.1':
eventlog.c:(.text+0x149c): undefined reference to `sudo_closefrom'
collect2: error: ld returned 1 exit status
Fixes:
- http://autobuild.buildroot.org/results/515b45f876fa9de03c9235f86017f4dc10eb3b54
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com >
2021-01-22 07:00:18 -07:00
Todd C. Miller
d98dd5f98d
Fix setprogname() emulation on systems without it.
...
For fully-qualified paths, store the string starting after the last slash,
not at the slash itself.
2021-01-15 15:25:44 -07:00
Todd C. Miller
4e11bc0e26
Suppress PVS Studio false positives.
2021-01-06 14:27:09 -07:00
Todd C. Miller
84b3a1dae1
Remove the --force option from the cppcheck args, it causes errors.
2021-01-06 13:01:09 -07:00
Todd C. Miller
9e068c15e0
Add setprogname(3) for those without it.
2021-01-06 13:01:09 -07:00
Todd C. Miller
71339c574f
Check the return value of fcntl() when setting FD_CLOEXEC.
...
This should never fail unless the fd is invalid.
Problem reported by Matthias Gerstner of SUSE.
2021-01-06 10:16:00 -07:00
Todd C. Miller
b132def0b1
For sudo, only allow "sudo" or "sudoedit" as the program name.
...
The program name is also used when matching Debug lines in sudo.conf.
We don't want the user to be able to influence sudo.conf Debug matching.
The string "sudoedit" is treated the same as "sudo" in sudo.conf.
Problem reported by Matthias Gerstner of SUSE.
2021-01-06 10:16:00 -07:00
Todd C. Miller
6e1986e915
Remove #ifdefs around code using pread(3) and pwrite(3).
2021-01-02 10:43:34 -07:00
Todd C. Miller
06bfbecd64
Add emulation of pread(3) and pwrite(3) for systems without them.
...
This makes it possible to remove some ugly #ifdefs and only affects
very old systems.
2021-01-02 10:43:34 -07:00
Todd C. Miller
8617833385
Minor fixes pointed out by cppcheck.
...
Also add compareBoolExpressionWithInt to suppression list.
2021-01-02 10:43:34 -07:00
Todd C. Miller
9547755c3f
Fix deregistration of a callback that is not at the head of the list.
...
The SLIST_FOREACH_PREVPTR macro doesn't work the way I thought it did.
Just store our own prev pointer and use that instead.
2020-12-30 07:09:35 -07:00
Todd C. Miller
567e5167d1
Don't assume that just because command is non-NULL, argv is non-NULL.
2020-12-04 13:48:16 -07:00