Skip to content

Commit

Permalink
fix(process,windows): compare len(cwd) to an incorrect value
Browse files Browse the repository at this point in the history
process/process_windows.go#L411 len(cwd) need compare to userProcParams.CurrentDirectoryPathNameLength instead of userProcParams.CurrentDirectoryPathAddress
  • Loading branch information
tienthanh1993 committed Aug 25, 2022
1 parent ed37dc2 commit 6bc3396
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion process/process_windows.go
Expand Up @@ -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")
}

Expand Down

0 comments on commit 6bc3396

Please sign in to comment.