aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-29 00:00:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-29 00:00:14 +0000
commit2f86d13dff6f2a5d4b8ac9350d306ca119a7e0e8 (patch)
treed3817a23aa476cac5b7e800f1008668a2473d139
parent043d15da31200d35c24bc1939ae6b561f5016c84 (diff)
downloadbusybox-2f86d13dff6f2a5d4b8ac9350d306ca119a7e0e8.tar.gz
libbb: dump: do not use uninitialized memory. close bug 4364.
-rw-r--r--libbb/dump.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbb/dump.c b/libbb/dump.c
index 0d553d4d0..74c5e1691 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -376,17 +376,16 @@ static unsigned char *get(priv_dumper_t *dumper)
{
int n;
int need, nread;
- unsigned char *tmpp;
int blocksize = dumper->blocksize;
if (!dumper->get__curp) {
dumper->address = (off_t)0; /*DBU:[dave@cray.com] initialize,initialize..*/
dumper->get__curp = xmalloc(blocksize);
- dumper->get__savp = xmalloc(blocksize);
+ dumper->get__savp = xzalloc(blocksize); /* need to be initialized */
} else {
- tmpp = dumper->get__curp;
+ unsigned char *tmp = dumper->get__curp;
dumper->get__curp = dumper->get__savp;
- dumper->get__savp = tmpp;
+ dumper->get__savp = tmp;
dumper->savaddress += blocksize;
dumper->address = dumper->savaddress;
}