From 6bc339626b2338cb11fa02058f30d30b2b614b27 Mon Sep 17 00:00:00 2001 From: tienthanh1993 Date: Thu, 25 Aug 2022 20:09:21 +0700 Subject: [PATCH] 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 --- process/process_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/process_windows.go b/process/process_windows.go index 18f4f9455..17f7bc866 100644 --- a/process/process_windows.go +++ b/process/process_windows.go @@ -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") }