]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: revert security_windows.go change of CL 201877
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 29 Oct 2019 16:02:14 +0000 (23:02 +0700)
committerAlex Brainman <alex.brainman@gmail.com>
Thu, 7 Nov 2019 09:32:43 +0000 (09:32 +0000)
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 <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/syscall/security_windows.go

index e35c4a0c258acfb1dce4910c918d263fc82b5ac5..db80d98a084d019832c52cce5a77126663951ecc 100644 (file)
@@ -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.