mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpgtar: Fix extracting files with !(size % 512)
* tools/gpgtar-extract.c (extract_regular): Handle size multiples of RECORDSIZE. -- If a hdr->size was a multiple of 512 the last record would not have been written and the files corrupted accordingly. GnuPG-bug-id: 1926 Signed-off-by: Andre Heinecke <aheinecke@intevation.de> Changed to use only if-else. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
9078b75a73
commit
6cbbb0bec9
@ -66,7 +66,11 @@ extract_regular (estream_t stream, const char *dirname,
|
||||
if (err)
|
||||
goto leave;
|
||||
n++;
|
||||
nbytes = (n < hdr->nrecords)? RECORDSIZE : (hdr->size % RECORDSIZE);
|
||||
if (n < hdr->nrecords || (hdr->size && !(hdr->size % RECORDSIZE)))
|
||||
nbytes = RECORDSIZE;
|
||||
else
|
||||
nbytes = (hdr->size % RECORDSIZE);
|
||||
|
||||
nwritten = es_fwrite (record, 1, nbytes, outfp);
|
||||
if (nwritten != nbytes)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user