From: Karel Zak Date: Fri, 16 Oct 2009 21:37:22 +0000 (+0200) Subject: initctl: fix strict-aliasing bugs X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23387a68a7746e14fe7b3f04af16bc4ffcdfbb12;p=util-linux initctl: fix strict-aliasing bugs Signed-off-by: Karel Zak --- diff --git a/login-utils/initctl.c b/login-utils/initctl.c index 6fb8d097..3b38b496 100644 --- a/login-utils/initctl.c +++ b/login-utils/initctl.c @@ -64,8 +64,15 @@ int main (int argc, char **argv) struct sigaction sa; sigset_t ss; char *ptr; - long buffer[COMMAND_SIZE / sizeof (long) + 1]; - struct command_struct *command = (struct command_struct *) buffer; + long *buffer; + struct command_struct *command; + + buffer = calloc(COMMAND_SIZE / sizeof (long) + 1, sizeof(long)); + if (!buffer) { + fprintf (stderr, "Unable allocate buffer for command\n"); + exit(1); + } + command = (struct command_struct *) buffer; sigemptyset (&ss); sigaddset (&ss, SIG_PRESENT);