aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-02-04 10:48:37 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-02-04 10:48:37 +0000
commit11ad23a8bc381b4a9c2ae3027b0c45b7ab0b89c2 (patch)
tree2341b9ef23d649087b3a48b35ba3cdd66087bea5 /libbb
parentf830fa0b17707691b1de3c286ae06674f194ec66 (diff)
downloadbusybox-w32-11ad23a8bc381b4a9c2ae3027b0c45b7ab0b89c2.tar.gz
busybox-w32-11ad23a8bc381b4a9c2ae3027b0c45b7ab0b89c2.tar.bz2
busybox-w32-11ad23a8bc381b4a9c2ae3027b0c45b7ab0b89c2.zip
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. git-svn-id: svn://busybox.net/trunk/busybox@8397 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/getopt_ulflags.c2
1 files changed, 2 insertions, 0 deletions
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, ...)
88 t_complementaly *on_off; 88 t_complementaly *on_off;
89 va_list p; 89 va_list p;
90 90
91 memset(&complementaly, 0, sizeof(complementaly));
92
91 va_start (p, applet_opts); 93 va_start (p, applet_opts);
92 94
93 /* skip GNU extension */ 95 /* skip GNU extension */