Commit 3b1ae308 authored by Cuong Manh Le's avatar Cuong Manh Le Committed by Alex Brainman

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 7a2baa9c
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment