From 23387a68a7746e14fe7b3f04af16bc4ffcdfbb12 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Oct 2009 23:37:22 +0200 Subject: [PATCH] initctl: fix strict-aliasing bugs Signed-off-by: Karel Zak --- login-utils/initctl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); -- 2.39.5