|
|
@ -24,6 +24,7 @@
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <charconv>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sstream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <filesystem>
|
|
|
@ -563,7 +564,16 @@ bool TarScanner::AddFile(const std::string &filename, size_t, [[maybe_unused]] c
|
|
|
|
|
|
|
|
|
|
|
|
/* The size of the file, for some strange reason, this is stored as a string in octals. */
|
|
|
|
/* The size of the file, for some strange reason, this is stored as a string in octals. */
|
|
|
|
std::string size = ExtractString(th.size);
|
|
|
|
std::string size = ExtractString(th.size);
|
|
|
|
size_t skip = size.empty() ? 0 : std::stoul(size, nullptr, 8);
|
|
|
|
size_t skip = 0;
|
|
|
|
|
|
|
|
if (!size.empty()) {
|
|
|
|
|
|
|
|
StrTrimInPlace(size);
|
|
|
|
|
|
|
|
auto [_, err] = std::from_chars(size.data(), size.data() + size.size(), skip, 8);
|
|
|
|
|
|
|
|
if (err != std::errc()) {
|
|
|
|
|
|
|
|
Debug(misc, 0, "The file '{}' has an invalid size for '{}'", filename, name);
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (th.typeflag) {
|
|
|
|
switch (th.typeflag) {
|
|
|
|
case '\0':
|
|
|
|
case '\0':
|
|
|
|