diff options
Diffstat (limited to 'updater/msirunner_windows.go')
-rw-r--r-- | updater/msirunner_windows.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/updater/msirunner_windows.go b/updater/msirunner_windows.go index c11d4db9..f7ee35a2 100644 --- a/updater/msirunner_windows.go +++ b/updater/msirunner_windows.go @@ -68,9 +68,11 @@ func msiTempFile() (*os.File, error) { Length: uint32(unsafe.Sizeof(windows.SecurityAttributes{})), SecurityDescriptor: sd, } - // TODO: os.TempDir() returns C:\windows\temp when calling from this context. Supposedly this is mostly secure - // against TOCTOU, but who knows! Look into this! - name := filepath.Join(os.TempDir(), hex.EncodeToString(randBytes[:])) + windir, err := windows.GetWindowsDirectory() + if err != nil { + return nil, err + } + name := filepath.Join(windir, "Temp", hex.EncodeToString(randBytes[:])) name16 := windows.StringToUTF16Ptr(name) // TODO: it would be nice to specify delete_on_close, but msiexec.exe doesn't open its files with read sharing. fileHandle, err := windows.CreateFile(name16, windows.GENERIC_WRITE, windows.FILE_SHARE_READ, sa, windows.CREATE_NEW, windows.FILE_ATTRIBUTE_NORMAL, 0) |