Commit Graph

173 Commits

Author SHA1 Message Date
Todd C. Miller
f2f5c2949c Add line number to debug log for memory allocation errors. 2015-07-14 14:47:12 -06:00
Todd C. Miller
43a57126ea Solaris 2.6 has the prototypes for inet_pton() and inet_ntop() in
resolv.h.
2015-07-09 10:11:25 -06:00
Todd C. Miller
445e6f2e9a Check sudo_conf_read() return value and exit on fatal error (a
warning was already printed by sudo_conf_read()).
2015-07-07 13:17:50 -06:00
Todd C. Miller
d77941c2be We require POSIX so no need to conditionally include dirent.h.
Add a check for d_namlen and use the result in the NAMLEN macro.
2015-07-02 09:24:48 -06:00
Todd C. Miller
0b241088b3 There's no need to conditionalize the #include <unistd.h>, we require
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
5e695d4cd9 Add missing exit value. 2015-06-30 12:19:24 -06:00
Todd C. Miller
662f9ec562 Add missing fcntl.h include. 2015-06-30 12:19:17 -06:00
Todd C. Miller
105f199f6b Fix build on compilers w/o __func__ or __FUNCTION__ 2015-06-30 10:41:14 -06:00
Todd C. Miller
44f7ed3b11 Remove sudo_evasprintf_v1, missed during alloc.c removal. 2015-06-30 10:37:06 -06:00
Todd C. Miller
b756b6a112 Add missing fcntl.h include. 2015-06-30 10:32:42 -06:00
Todd C. Miller
54f9de6cce Add an error flag to the lbuf struct to simplify error checking.
Callers of the lbuf functions now check the error flag to tell if
a memory allocation error ocurred.
2015-06-26 15:58:04 -06:00
Todd C. Miller
d36e46cb6e Must call round_nfds() with fd+1 since it takes a count not the fd
number.  In other words, the lowest value is 1, not 0.
2015-06-23 13:49:56 -06:00
Todd C. Miller
d7224ea502 It's safe to rely on C89 semantics for realloc(NULL, size). 2015-06-20 19:27:31 -06:00
Todd C. Miller
4da6468d5a Remove symbols from the now-removed alloc.c. 2015-06-20 16:56:42 -06:00
Todd C. Miller
4a07b472f0 Only include stddef.h where it is needed. 2015-06-20 05:34:35 -06:00
Todd C. Miller
d8dd6512ce Better handling of setlocale() returning NULL. 2015-06-19 16:49:02 -06:00
Todd C. Miller
c36415417f Add function name to "unable to allocate memory" warnings. 2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454 We require ANSI C so stop using the obsolete STDC_HEADERS. 2015-06-19 14:29:27 -06:00
Todd C. Miller
e2328479dd Use strtok_r() instead of strtok() 2015-06-19 12:35:51 -06:00
Todd C. Miller
4f9cabd005 Remove obsolete memory.h include. 2015-06-18 21:02:57 -06:00
Todd C. Miller
a50555faa2 Remove support for the obsolete malloc.h header. 2015-06-18 20:30:59 -06:00
Todd C. Miller
86fb8e15a8 Use sudo_strsplit() instead of doing the equivalent manually. 2015-06-18 16:14:49 -06:00
Todd C. Miller
db3012645e Test strsplit behavior with an empty string. 2015-06-18 16:14:20 -06:00
Todd C. Miller
ea744042ed Allow "make LIBTOOL=/path/to/libtool" to work properly. 2015-06-18 13:06:15 -06:00
Todd C. Miller
a38253b101 Replace use of OSDEFS with config.h defines.
Rename DEFS in Makefile.in to CPPDEFS and include in CPPFLAGS.
Bring back _BSD_SOURCE as a config.h define.
Remove obsolescent _REENTRANT define.
2015-06-18 09:33:05 -06:00
Todd C. Miller
4be97a6c4e Remove now-unused sudo_alloc.h and alloc.c 2015-06-17 17:00:55 -06:00
Todd C. Miller
5ce50a885c Use non-exiting allocators in libsudo_util. 2015-06-17 17:00:53 -06:00
Todd C. Miller
2c63f1b5b2 regen dependencies 2015-06-16 13:17:46 -06:00
Todd C. Miller
23d72149b0 Add missing dependency info for reallocarray.lo in lib/util/Makefile.in
and regen configure to match last configure.ac change.
2015-06-15 13:45:12 -06:00
Todd C. Miller
f43f530987 Move pattern length check until after we have initialized the glob_t
so we can call globfree() even on error.  From Frank Denis.
2015-06-13 08:13:48 -06:00
Todd C. Miller
c0fa0e248d Add debugging output on memory alloc failure.
Add missing checks in event_select.c for reallocarray() failure.
2015-06-05 13:18:48 -06:00
Todd C. Miller
564eb7e7dd Use non-exiting allocators. 2015-06-05 13:17:56 -06:00
Todd C. Miller
9884df8c9e If asprintf() or vasprintf() fail, set the dest pointer to NULL
like BSD and Solaris do.  This appears to be the direction glibc
is going as well.
2015-06-03 11:07:56 -06:00
Todd C. Miller
1100d91e8f Fix typo/thinko in static buffer conversion; use vsnprintf() not snprintf() 2015-05-27 16:41:46 -06:00
Todd C. Miller
6b7be032af Use non-existing allocators in the passwd/group cache functions. 2015-05-27 10:26:49 -06:00
Todd C. Miller
40d72f26e4 Add standalone reallocarray.c from OpenBSD instead of rolling our own. 2015-05-27 10:04:32 -06:00
Todd C. Miller
8c3fd195d2 Add unit tests for strsplit and parse_gid_list. 2015-05-26 20:25:08 -06:00
Todd C. Miller
8d1708434f Add sudo_strsplit(), similar to strtok_r() but non-destructive and
operates on non-C strings (requires a length parameter).
2015-05-26 15:46:41 -06:00
Todd C. Miller
6741fb5378 Use non-exiting allocators. 2015-05-20 10:39:08 -06:00
Todd C. Miller
f18aa478d3 Use a static buffer for sudo_warn/sudo_fatal messages where possible. 2015-05-26 15:24:54 -06:00
Todd C. Miller
82286d8b7b Add strndup() for those without it. As strndup.c uses strnlen(),
use our own if it is missing.
2015-05-26 14:05:26 -06:00
Todd C. Miller
8437e3606b Add missing sudo_ prefix and include sudo_compat.h. 2015-05-26 14:01:37 -06:00
Todd C. Miller
49d56f323e Add strnlen() replacement needed for glob.c.
Only used if no glob() and no strnlen().
2015-05-26 13:55:18 -06:00
Todd C. Miller
05a01d4c5d Avoid using a leading underbar in defines as they are reserved in
ISO C.
2015-05-21 11:13:20 -06:00
Todd C. Miller
1298ea9107 Add target for "make splint". A few files need extra guards to avoid
errors on systems where they would not otherwise be compiled.
No warnings from splint.
2015-05-21 11:07:13 -06:00
Todd C. Miller
cbcaaa299a No need to cast malloc() return value. 2015-05-14 10:47:09 -06:00
Todd C. Miller
c75eb5bf0d Use reallocarray where possible. 2015-05-14 10:21:58 -06:00
Todd C. Miller
3595807f4e Add reallocarray() for those without it. 2015-05-14 10:13:18 -06:00
Todd C. Miller
80cb630bc0 In sudo_warn_gettext_v1() call dgettext() not gettext() to make
sure the domain is set correctly.  The sudoers plugin uses its own
text domain.
2015-05-12 15:58:05 -06:00
Todd C. Miller
8bc70a635c Instead of trying to make weak functions work on all platforms,
just use a registration function for a plugin-specific setlocale
function.  The sudoers version just wraps sudoers_setlocale().
2015-05-11 14:51:32 -06:00