1
0
mirror of https://github.com/golang/go synced 2024-11-06 22:26:11 -07:00

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 <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Cuong Manh Le 2019-10-29 23:02:14 +07:00 committed by Alex Brainman
parent 7a2baa9c48
commit 3b1ae308a4

View 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.