Skip to content

Commit 1870a01

Browse files
authored
Use windows.ByteSliceFromString for null-terminated drive path
1 parent e27ed44 commit 1870a01

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

go/extractor/subst/subst_windows.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ func ResolveDrive(driveRoot string) string {
4545
if !available {
4646
return ""
4747
}
48-
driveBytes := append([]byte(driveRoot), 0)
48+
driveBytes, err := windows.ByteSliceFromString(driveRoot)
49+
if err != nil {
50+
return ""
51+
}
4952
ret, _, _ := procResolve.Call(uintptr(unsafe.Pointer(&driveBytes[0])))
5053
if ret == 0 {
5154
return ""

0 commit comments

Comments
 (0)