>From c4d5c14d5cc247db9016000f7832c81c4f0707c7 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 15 Aug 2013 11:43:17 +0200 Subject: [PATCH] tar: fix use of uninitialized memory This complements 26538c9bf. * src/names.c (name_add_file): Initialize the ep->v.file.fp pointer after structure allocation. * tests/testsuite.at: Export MALLOC_PERTURB_ environmental variables for whole testsuite. This should avoid bugs like this. For platforms not supporting that it should be innocent, but lets see what will happen. --- src/names.c | 1 + tests/testsuite.at | 1 + 2 files changed, 2 insertions(+) diff --git a/src/names.c b/src/names.c index f3a3536..c8e2f03 100644 --- a/src/names.c +++ b/src/names.c @@ -291,6 +291,7 @@ name_add_file (const char *name, int term) ep->type = NELT_FILE; ep->v.file.name = name; ep->v.file.term = term; + ep->v.file.fp = NULL; /* not opened yet */ } /* Names from external name file. */ diff --git a/tests/testsuite.at b/tests/testsuite.at index 605cca3..7721b5b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -33,6 +33,7 @@ TEST_TAR_FORMAT=FMT export TEST_TAR_FORMAT TAR_OPTIONS="-H FMT" export TAR_OPTIONS +export MALLOC_PERTURB_=170 rm -rf * $1)],$2,$3,$4,$5,$6) AT_TAR_CHECK_HOOK]) -- 1.8.3.1