vendor: golang.org/x/net v0.4.0
golang.org/x/net contains a fix for CVE-2022-41717, which was addressed in stdlib in go1.19.4 and go1.18.9; > net/http: limit canonical header cache by bytes, not entries > > An attacker can cause excessive memory growth in a Go server accepting > HTTP/2 requests. > > HTTP/2 server connections contain a cache of HTTP header keys sent by > the client. While the total number of entries in this cache is capped, > an attacker sending very large keys can cause the server to allocate > approximately 64 MiB per open connection. > > This issue is also fixed in golang.org/x/net/http2 v0.4.0, > for users manually configuring HTTP/2. full diff: https://github.com/golang/net/compare/v0.2.0...v0.4.0 other dependency updates (due to (circular) dependencies): - golang.org/x/sys v0.3.0: https://github.com/golang/sys/compare/3c1f35247d10...v0.3.0 - golang.org/x/text v0.5.0: https://github.com/golang/text/compare/v0.3.7...v0.5.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7847817946
commit
345be95498
168 changed files with 19829 additions and 2149 deletions
131
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
131
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
|
@ -138,13 +138,7 @@ func UTF16PtrToString(p *uint16) string {
|
|||
ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p))
|
||||
}
|
||||
|
||||
var s []uint16
|
||||
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
||||
h.Data = unsafe.Pointer(p)
|
||||
h.Len = n
|
||||
h.Cap = n
|
||||
|
||||
return string(utf16.Decode(s))
|
||||
return string(utf16.Decode(unsafe.Slice(p, n)))
|
||||
}
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
@ -364,6 +358,16 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
|
||||
//sys EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) = user32.EnumChildWindows
|
||||
//sys GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) = user32.GetClassNameW
|
||||
//sys GetDesktopWindow() (hwnd HWND) = user32.GetDesktopWindow
|
||||
//sys GetForegroundWindow() (hwnd HWND) = user32.GetForegroundWindow
|
||||
//sys IsWindow(hwnd HWND) (isWindow bool) = user32.IsWindow
|
||||
//sys IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode
|
||||
//sys IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible
|
||||
//sys GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo
|
||||
//sys GetLargePageMinimum() (size uintptr)
|
||||
|
||||
// Volume Management Functions
|
||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||
|
@ -417,6 +421,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation
|
||||
//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW
|
||||
//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW
|
||||
//sys QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) = psapi.QueryWorkingSetEx
|
||||
|
||||
// NT Native APIs
|
||||
//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb
|
||||
|
@ -438,6 +443,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//sys RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) = ntdll.RtlAddFunctionTable
|
||||
//sys RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) = ntdll.RtlDeleteFunctionTable
|
||||
|
||||
// Desktop Window Manager API (Dwmapi)
|
||||
//sys DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute
|
||||
//sys DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute
|
||||
|
||||
// syscall interface implementation for other packages
|
||||
|
||||
// GetCurrentProcess returns the handle for the current process.
|
||||
|
@ -747,7 +756,7 @@ func Utimes(path string, tv []Timeval) (err error) {
|
|||
if e != nil {
|
||||
return e
|
||||
}
|
||||
defer Close(h)
|
||||
defer CloseHandle(h)
|
||||
a := NsecToFiletime(tv[0].Nanoseconds())
|
||||
w := NsecToFiletime(tv[1].Nanoseconds())
|
||||
return SetFileTime(h, nil, &a, &w)
|
||||
|
@ -767,7 +776,7 @@ func UtimesNano(path string, ts []Timespec) (err error) {
|
|||
if e != nil {
|
||||
return e
|
||||
}
|
||||
defer Close(h)
|
||||
defer CloseHandle(h)
|
||||
a := NsecToFiletime(TimespecToNsec(ts[0]))
|
||||
w := NsecToFiletime(TimespecToNsec(ts[1]))
|
||||
return SetFileTime(h, nil, &a, &w)
|
||||
|
@ -971,6 +980,32 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
|
|||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
type RawSockaddrBth struct {
|
||||
AddressFamily [2]byte
|
||||
BtAddr [8]byte
|
||||
ServiceClassId [16]byte
|
||||
Port [4]byte
|
||||
}
|
||||
|
||||
type SockaddrBth struct {
|
||||
BtAddr uint64
|
||||
ServiceClassId GUID
|
||||
Port uint32
|
||||
|
||||
raw RawSockaddrBth
|
||||
}
|
||||
|
||||
func (sa *SockaddrBth) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
family := AF_BTH
|
||||
sa.raw = RawSockaddrBth{
|
||||
AddressFamily: *(*[2]byte)(unsafe.Pointer(&family)),
|
||||
BtAddr: *(*[8]byte)(unsafe.Pointer(&sa.BtAddr)),
|
||||
Port: *(*[4]byte)(unsafe.Pointer(&sa.Port)),
|
||||
ServiceClassId: *(*[16]byte)(unsafe.Pointer(&sa.ServiceClassId)),
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
|
@ -1081,9 +1116,13 @@ func Shutdown(fd Handle, how int) (err error) {
|
|||
}
|
||||
|
||||
func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) {
|
||||
rsa, l, err := to.sockaddr()
|
||||
if err != nil {
|
||||
return err
|
||||
var rsa unsafe.Pointer
|
||||
var l int32
|
||||
if to != nil {
|
||||
rsa, l, err = to.sockaddr()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine)
|
||||
}
|
||||
|
@ -1707,3 +1746,71 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) {
|
|||
h.Cap = int(size)
|
||||
return
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_BLOCK contains extended working set information for a page.
|
||||
type PSAPI_WORKING_SET_EX_BLOCK uint64
|
||||
|
||||
// Valid returns the validity of this page.
|
||||
// If this bit is 1, the subsequent members are valid; otherwise they should be ignored.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Valid() bool {
|
||||
return (b & 1) == 1
|
||||
}
|
||||
|
||||
// ShareCount is the number of processes that share this page. The maximum value of this member is 7.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) ShareCount() uint64 {
|
||||
return b.intField(1, 3)
|
||||
}
|
||||
|
||||
// Win32Protection is the memory protection attributes of the page. For a list of values, see
|
||||
// https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Win32Protection() uint64 {
|
||||
return b.intField(4, 11)
|
||||
}
|
||||
|
||||
// Shared returns the shared status of this page.
|
||||
// If this bit is 1, the page can be shared.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Shared() bool {
|
||||
return (b & (1 << 15)) == 1
|
||||
}
|
||||
|
||||
// Node is the NUMA node. The maximum value of this member is 63.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Node() uint64 {
|
||||
return b.intField(16, 6)
|
||||
}
|
||||
|
||||
// Locked returns the locked status of this page.
|
||||
// If this bit is 1, the virtual page is locked in physical memory.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Locked() bool {
|
||||
return (b & (1 << 22)) == 1
|
||||
}
|
||||
|
||||
// LargePage returns the large page status of this page.
|
||||
// If this bit is 1, the page is a large page.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) LargePage() bool {
|
||||
return (b & (1 << 23)) == 1
|
||||
}
|
||||
|
||||
// Bad returns the bad status of this page.
|
||||
// If this bit is 1, the page is has been reported as bad.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Bad() bool {
|
||||
return (b & (1 << 31)) == 1
|
||||
}
|
||||
|
||||
// intField extracts an integer field in the PSAPI_WORKING_SET_EX_BLOCK union.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) intField(start, length int) uint64 {
|
||||
var mask PSAPI_WORKING_SET_EX_BLOCK
|
||||
for pos := start; pos < start+length; pos++ {
|
||||
mask |= (1 << pos)
|
||||
}
|
||||
|
||||
masked := b & mask
|
||||
return uint64(masked >> start)
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_INFORMATION contains extended working set information for a process.
|
||||
type PSAPI_WORKING_SET_EX_INFORMATION struct {
|
||||
// The virtual address.
|
||||
VirtualAddress Pointer
|
||||
// A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress.
|
||||
VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue