Fix segfault when extracting from a multi-volume archive.

Fix suggested by Pavel Raiskup.

* src/buffer.c (try_new_volume): Fix dereferencing NULL pointer.
* tests/multiv09.at: New testcase.
* tests/Makefile.am: Add new testcase.
* tests/testsuite.at: Likewise.
This commit is contained in:
Sergey Poznyakoff
2015-12-06 22:02:16 +02:00
parent 5dd490e7f1
commit 0a93c16c62
4 changed files with 58 additions and 2 deletions
+8 -2
View File
@@ -1493,8 +1493,14 @@ try_new_volume (void)
if (bufmap_head)
{
uintmax_t s;
if (!continued_file_name
|| strcmp (continued_file_name, bufmap_head->file_name))
if (!continued_file_name)
{
WARN ((0, 0, _("%s is not continued on this volume"),
quote (bufmap_head->file_name)));
return false;
}
if (strcmp (continued_file_name, bufmap_head->file_name))
{
if ((archive_format == GNU_FORMAT || archive_format == OLDGNU_FORMAT)
&& strlen (bufmap_head->file_name) >= NAME_FIELD_SIZE