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.
This commit is contained in:
Eric Andersen 2004-02-04 10:48:37 +00:00
parent 5b0d7deb75
commit 4575bbf7b8

View File

@ -88,6 +88,8 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
t_complementaly *on_off; t_complementaly *on_off;
va_list p; va_list p;
memset(&complementaly, 0, sizeof(complementaly));
va_start (p, applet_opts); va_start (p, applet_opts);
/* skip GNU extension */ /* skip GNU extension */