From 3b1ae308a40d4548f7dab84d22e62838fcdbb354 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 29 Oct 2019 23:02:14 +0700 Subject: [PATCH] syscall: revert security_windows.go change of CL 201877 This CL was verified by running: go test -gcflags=all=-d=checkptr=2 internal/syscall/windows internal/syscall/windows.TestRunAtLowIntegrity uses code in question. Updates #34972 Change-Id: I434530058e2d41f132e9bf154e8c64c03894e9c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/204117 Run-TryBot: Cuong Manh Le TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/syscall/security_windows.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/syscall/security_windows.go b/src/syscall/security_windows.go index e35c4a0c258..db80d98a084 100644 --- a/src/syscall/security_windows.go +++ b/src/syscall/security_windows.go @@ -157,15 +157,13 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32, // String converts sid to a string format // suitable for display, storage, or transmission. func (sid *SID) String() (string, error) { - // From https://docs.microsoft.com/en-us/windows/win32/secbiomet/general-constants - const SecurityMaxSidSize = 68 var s *uint16 e := ConvertSidToStringSid(sid, &s) if e != nil { return "", e } defer LocalFree((Handle)(unsafe.Pointer(s))) - return UTF16ToString((*[SecurityMaxSidSize]uint16)(unsafe.Pointer(s))[:]), nil + return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil } // Len returns the length, in bytes, of a valid security identifier sid.