From 4575bbf7b846d9dfd6ff50bb4bc1f6f4ac31f3c0 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 4 Feb 2004 10:48:37 +0000 Subject: [PATCH] The variable 'complementaly' used to be allocated with calloc, which zeroed it out during the allocation process. When vodz changed it to be allocated on the stack, he forgot to explicitly zero it, leaving its value filled with whatever used to be sitting on the stack. It would garbage values, depending on the garbage that happened to be sitting on the stack when the function was called. The result was that applets using bb_getopt_ulflags() were showing unpredictable behavior (such as segfaults), which naturally broke many things. --- libbb/getopt_ulflags.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libbb/getopt_ulflags.c b/libbb/getopt_ulflags.c index 81d22c3fe..cca0743bd 100644 --- a/libbb/getopt_ulflags.c +++ b/libbb/getopt_ulflags.c @@ -88,6 +88,8 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) t_complementaly *on_off; va_list p; + memset(&complementaly, 0, sizeof(complementaly)); + va_start (p, applet_opts); /* skip GNU extension */