Skip to content

Fix compilation on systems with larger utsname field sizes #116

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ellert
Copy link
Contributor

@ellert ellert commented May 4, 2025

On Linux the sizes of the sysname and machine fields are 65 bytes and the target array is large enough to hold the result of the snprintf command.

On platforms where the sizes of the fields are larger, e.g. GNY/Hurd where they are 1024 bytes, the results overflows.

src/request.c:1105:57: error: ‘%s’ directive output may be truncated writing up to 2048 bytes into a region of size between 211 and 218 [-Werror=format-truncation=]

This change does not change the size of the array on Linux: 126 + 65 + 65 = 256

On Linux the sizes of the sysname and machine fields are 65 bytes and
the target array is large enough to hold the result of the snprintf
command.

On platforms where the sizes of the fields are larger, e.g. GNY/Hurd
where they are 1024 bytes, the results overflows.

src/request.c:1105:57: error: ‘%s’ directive output may be truncated writing up to 2048 bytes into a region of size between 211 and 218 [-Werror=format-truncation=]

This change does not change the size of the array on Linux:
126 + 65 + 65 = 256
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.

1 participant