1
0
Fork 0

(svn r26082) -Fix [FS#5816] (r26077): tar files with more than one file in the root directory would not be read properly (zydeco)

release/1.4
rubidium 2013-11-24 13:00:06 +00:00
parent 6fb28d8719
commit b75e60124d
1 changed files with 3 additions and 1 deletions

View File

@ -761,7 +761,7 @@ bool TarScanner::AddFile(const char *filename, size_t basepath_length, const cha
TarHeader th; TarHeader th;
char buf[sizeof(th.name) + 1], *end; char buf[sizeof(th.name) + 1], *end;
char name[sizeof(th.prefix) + 1 + sizeof(th.name) + 1] = ""; char name[sizeof(th.prefix) + 1 + sizeof(th.name) + 1];
char link[sizeof(th.linkname) + 1]; char link[sizeof(th.linkname) + 1];
char dest[sizeof(th.prefix) + 1 + sizeof(th.name) + 1 + 1 + sizeof(th.linkname) + 1]; char dest[sizeof(th.prefix) + 1 + sizeof(th.name) + 1 + 1 + sizeof(th.linkname) + 1];
size_t num = 0, pos = 0; size_t num = 0, pos = 0;
@ -784,6 +784,8 @@ bool TarScanner::AddFile(const char *filename, size_t basepath_length, const cha
return false; return false;
} }
name[0] = '\0';
/* The prefix contains the directory-name */ /* The prefix contains the directory-name */
if (th.prefix[0] != '\0') { if (th.prefix[0] != '\0') {
ttd_strlcpy(name, th.prefix, lengthof(name)); ttd_strlcpy(name, th.prefix, lengthof(name));