[BusyBox-cvs] busybox/libbb getopt_ulflags.c,1.6,1.7

Erik Andersen andersen at busybox.net
Wed Feb 4 10:48:39 UTC 2004


Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv16929/libbb

Modified Files:
	getopt_ulflags.c 
Log Message:
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.


Index: getopt_ulflags.c
===================================================================
RCS file: /var/cvs/busybox/libbb/getopt_ulflags.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- getopt_ulflags.c	22 Jan 2004 07:10:13 -0000	1.6
+++ getopt_ulflags.c	4 Feb 2004 10:48:37 -0000	1.7
@@ -88,6 +88,8 @@
   t_complementaly *on_off;
   va_list p;
 
+  memset(&complementaly, 0, sizeof(complementaly));
+
   va_start (p, applet_opts);
 
   /* skip GNU extension */




More information about the busybox-cvs mailing list