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.
This commit is contained in:
@@ -291,7 +291,7 @@ sudo_ev_set_v1(struct sudo_event *ev, int fd, short events,
|
||||
/* For SUDO_EV_SIGINFO we use a container to store closure + siginfo_t */
|
||||
if (ISSET(events, SUDO_EV_SIGINFO)) {
|
||||
struct sudo_ev_siginfo_container *container =
|
||||
malloc(sizeof(*container) + sizeof(siginfo_t) - 1);
|
||||
malloc(sizeof(*container) + sizeof(siginfo_t));
|
||||
if (container == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to allocate siginfo container", __func__);
|
||||
|
Reference in New Issue
Block a user