diff options
author | rubidium <rubidium@openttd.org> | 2013-11-24 13:00:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-24 13:00:06 +0000 |
commit | b75e60124dd3d718ce649a419dc6fe5abccc513d (patch) | |
tree | d4ff6ca8464f89ce2e2dea39974af280f5fc985c /src | |
parent | 6fb28d87196305d0d016499215ba9d6503e1c6cf (diff) | |
download | openttd-b75e60124dd3d718ce649a419dc6fe5abccc513d.tar.xz |
(svn r26082) -Fix [FS#5816] (r26077): tar files with more than one file in the root directory would not be read properly (zydeco)
Diffstat (limited to 'src')
-rw-r--r-- | src/fileio.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp index 1b773f0e8..a6cb85d74 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -761,7 +761,7 @@ bool TarScanner::AddFile(const char *filename, size_t basepath_length, const cha TarHeader th; 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 dest[sizeof(th.prefix) + 1 + sizeof(th.name) + 1 + 1 + sizeof(th.linkname) + 1]; size_t num = 0, pos = 0; @@ -784,6 +784,8 @@ bool TarScanner::AddFile(const char *filename, size_t basepath_length, const cha return false; } + name[0] = '\0'; + /* The prefix contains the directory-name */ if (th.prefix[0] != '\0') { ttd_strlcpy(name, th.prefix, lengthof(name)); |