commit | 5e06dd20ab57da35ef5928e610f228177c91df6e | [log] [tgz] |
---|---|---|
author | Jason A. Donenfeld <Jason@zx2c4.com> | Sat Apr 03 09:50:12 2021 -0600 |
committer | Jason A. Donenfeld <Jason@zx2c4.com> | Sat Apr 03 16:11:42 2021 +0000 |
tree | 7c9fc1039830dbbe54c297e38f4bfc4f6ea5a322 | |
parent | 700132347e0702a3e5f100fba2752993b8de9600 [diff] |
windows: ensure SECURITY_DESCRIPTOR allocation is large enough Self-relative security descriptors can sometimes be smaller than the header size of the SECURITY_DESCRIPTOR struct, which is fine in C, but checkptr complains about it, so instead, ensure that the allocation is at least the size of the SECURITY_DESCRIPTOR struct. This fixes this splat: fatal error: checkptr: converted pointer straddles multiple allocations goroutine 36 [running]: runtime.throw(0x761c5f, 0x3a) /usr/lib/go/src/runtime/panic.go:1117 +0x79 fp=0xc00005dd90 sp=0xc00005dd60 pc=0x5fb8d9 runtime.checkptrAlignment(0xc0001a4020, 0x741860, 0x1) /usr/lib/go/src/runtime/checkptr.go:20 +0xc9 fp=0xc00005ddc0 sp=0xc00005dd90 pc=0x5c7729 golang.org/x/sys/windows.(*SECURITY_DESCRIPTOR).copySelfRelativeSecurityDescriptor(0x1b9ad638190, 0x2) /home/zx2c4/Projects/golang-dev/sys/windows/security_windows.go:1359 +0x1b7 fp=0xc00005de50 sp=0xc00005ddc0 pc=0x6f0077 golang.org/x/sys/windows.SecurityDescriptorFromString(0x754f2b, 0x2, 0x0, 0x0, 0x0) /home/zx2c4/Projects/golang-dev/sys/windows/security_windows.go:1371 +0xde fp=0xc00005deb8 sp=0xc00005de50 pc=0x6f019e Change-Id: I552017a93d4ca6f6debc6f8f445dac5c6717fed1 Reviewed-on: https://go-review.googlesource.com/c/sys/+/307129 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This repository holds supplemental Go packages for low-level interactions with the operating system.
The easiest way to install is to run go get -u golang.org/x/sys
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/sys
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the sys repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/sys:” in the subject line, so it is easy to find.