Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftWin32: compensate for GetComputerNameW's disregard of the null terminator #775

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

relgit
Copy link
Contributor

@relgit relgit commented Nov 29, 2023

Hi @compnerd, before I jump to the PR I just wanted to say thanks for all the work you're putting into this project 😀

Issue

GetComputerNameW disregards the null terminator when returning the size of the buffer. This leads to the following error when using Device.name:

Swift/CString.swift:284: Fatal error: input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated

Solution

Compensated the buffer size to account for the null terminator.

Copy link
Owner

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@compnerd compnerd merged commit fd147c8 into compnerd:main Nov 30, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants