1
0
mirror of https://github.com/fumiama/go-hide-param.git synced 2026-06-10 02:00:27 +08:00

fix -race

This commit is contained in:
fumiama
2021-09-19 22:59:13 +08:00
parent 0534143024
commit d7e707ecec

View File

@@ -10,9 +10,9 @@ import (
func Hide(position int) { func Hide(position int) {
if position > 0 && position < len(os.Args) { if position > 0 && position < len(os.Args) {
pwdstr := (*[2]uintptr)(unsafe.Pointer(&os.Args[position])) p := *(*unsafe.Pointer)(unsafe.Pointer(&os.Args[position]))
for i := 0; i < len(os.Args[position]); i++ { for i := 0; i < len(os.Args[position]); i++ {
*(*uint8)(unsafe.Pointer((*pwdstr)[0] + uintptr(i))) = '*' *(*uint8)(unsafe.Pointer(uintptr(p) + uintptr(i))) = '*'
} }
} }
} }