Compare commits

...

2 Commits

Author SHA1 Message Date
Ettore Di Giacinto
77b49d9c4a Tag 0.14.6 patchfix 2021-05-16 23:32:54 +02:00
Ettore Di Giacinto
4c3532e3c6 fixup: unchecked err causes invalid read in certain cases 2021-05-16 23:12:54 +02:00
2 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ var Verbose bool
var LockedCommands = []string{"install", "uninstall", "upgrade"} var LockedCommands = []string{"install", "uninstall", "upgrade"}
const ( const (
LuetCLIVersion = "0.14.5" LuetCLIVersion = "0.14.6"
LuetEnvPrefix = "LUET" LuetEnvPrefix = "LUET"
) )

View File

@@ -390,15 +390,15 @@ func tarModifierWrapperFunc(dst, path string, header *tar.Header, content io.Rea
f, err := os.Lstat(destPath) f, err := os.Lstat(destPath)
if err == nil { if err == nil {
Debug("File exists already, computing hash for", destPath) Debug("File exists already, computing hash for", destPath)
hash, err := hashFileContent(destPath) hash, herr := hashFileContent(destPath)
if err == nil { if herr == nil {
existingHash = hash existingHash = hash
} }
} }
Debug("Existing file hash: ", existingHash, "Tar file hashsum: ", tarHash) Debug("Existing file hash: ", existingHash, "Tar file hashsum: ", tarHash)
// We want to protect file only if the hash of the files are differing OR the file size are // We want to protect file only if the hash of the files are differing OR the file size are
differs := (existingHash != "" && existingHash != tarHash) || header.Size != f.Size() differs := (existingHash != "" && existingHash != tarHash) || (err != nil && f != nil && header.Size != f.Size())
// Check if exists // Check if exists
if helpers.Exists(destPath) && differs { if helpers.Exists(destPath) && differs {
for i := 1; i < 1000; i++ { for i := 1; i < 1000; i++ {