From ba50a5645c1d84b23501499c386010400b66a893 Mon Sep 17 00:00:00 2001 From: Shachar Tal Date: Mon, 2 Mar 2026 22:01:04 +0200 Subject: [PATCH] Fix TOCTOU race bug in tar extraction Signed-off-by: Shachar Tal --- pkg/archive/tar_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/archive/tar_unix.go b/pkg/archive/tar_unix.go index fa611006098f7..684ea5783d950 100644 --- a/pkg/archive/tar_unix.go +++ b/pkg/archive/tar_unix.go @@ -80,7 +80,7 @@ func openFile(name string, flag int, perm os.FileMode) (*os.File, error) { return nil, err } // Call chmod to avoid permission mask - if err := os.Chmod(name, perm); err != nil { + if err := f.Chmod(perm); err != nil { f.Close() return nil, err }