mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-12 23:01:14 +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> (cherry picked from commit 6cbbb0bec98e1acefc4c7163cc41a507469db920)
This commit is contained in:
parent
25e2b27b00
commit
0ed2cfcf05
@ -73,7 +73,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