summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-01-14 15:22:09 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-01-14 15:22:09 +0200
commitcb07844454d8cc9fb21f53ace75975f91185a120 (patch)
tree87efb60e0763ecd1c06107a70c53e8b5e424b687
parent2f5a57be4bcb4b6e641457ef0fc99bdbe84828ba (diff)
downloadtar-cb07844454d8cc9fb21f53ace75975f91185a120.tar.gz
tar-cb07844454d8cc9fb21f53ace75975f91185a120.tar.bz2
Fix possible NULL dereference (savannah bug #55369)
* src/sparse.c (pax_decode_header): Check return from find_next_block.
-rw-r--r--src/sparse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sparse.c b/src/sparse.c
index 127364e7..d642a463 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -1267,6 +1267,8 @@ pax_decode_header (struct tar_sparse_file *file)
{ \
set_next_block_after (b); \
b = find_next_block (); \
+ if (!b) \
+ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \
src = b->buffer; \
endp = b->buffer + BLOCKSIZE; \
} \
@@ -1279,6 +1281,8 @@ pax_decode_header (struct tar_sparse_file *file)
start = current_block_ordinal ();
set_next_block_after (current_header);
blk = find_next_block ();
+ if (!blk)
+ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
p = blk->buffer;
COPY_BUF (blk,nbuf,p);
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))

Return to:

Send suggestions and report system problems to the System administrator.