fix(process,windows): compare len(cwd) to an incorrect value

process/process_windows.go#L411 len(cwd) need compare to userProcParams.CurrentDirectoryPathNameLength instead of userProcParams.CurrentDirectoryPathAddress
pull/1346/head
tienthanh1993 3 years ago committed by GitHub
parent ed37dc27a2
commit 6bc339626b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -408,7 +408,7 @@ func (p *Process) CwdWithContext(_ context.Context) (string, error) {
}
if userProcParams.CurrentDirectoryPathNameLength > 0 {
cwd := readProcessMemory(syscall.Handle(h), procIs32Bits, uint64(userProcParams.CurrentDirectoryPathAddress), uint(userProcParams.CurrentDirectoryPathNameLength))
if len(cwd) != int(userProcParams.CurrentDirectoryPathAddress) {
if len(cwd) != int(userProcParams.CurrentDirectoryPathNameLength) {
return "", errors.New("cannot read current working directory")
}

Loading…
Cancel
Save