Skip to content

x/sys/windows: reject overlong inputs in NewNTString #80103

Description

@bg0d-droid

The x/sys/windows.NewNTString helper currently delegates length initialization to RtlInitString and does not reject strings that cannot fit in NTString's uint16 Length and MaximumLength fields. For overlong inputs, RtlInitString cannot accurately represent the source string, and the resulting NTString can have inconsistent length fields.

NewNTUnicodeString already rejects inputs that cannot fit in the corresponding 16-bit fields. NewNTString should do the same for ANSI strings and return syscall.EINVAL instead of returning a malformed NTString.

A pending fix and regression test are in CL 793100:

https://go-review.googlesource.com/c/sys/+/793100

Related GitHub PR:

golang/sys#281

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions