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

cfCatalogLoad: fix incorrect strncpy() limit calculation #49

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

proski
Copy link
Contributor

@proski proski commented Feb 17, 2024

Preserve the new allocated size in a variable and use it instead of sizeof().

The old calculation would wrap around in most cases, making the limit ineffective. For very short original length of human_readable (6 bytes or less on 64-bit platforms), the appended text would be cut short to fit the pointer size.

Preserve the new allocated size in a variable and use it instead of
sizeof().

The old calculation would wrap around in most cases, making the limit
ineffective. For very short original length of `human_readable` (6 bytes
or less on 64-bit platforms), the appended text would be cut short to
fit the pointer size.
Copy link
Member

@zdohnal zdohnal left a comment

Choose a reason for hiding this comment

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

LGTM!

@tillkamppeter tillkamppeter merged commit 48ff575 into OpenPrinting:master Feb 20, 2024
@tillkamppeter
Copy link
Member

Thanks a lot, @proski and @zdohnal .

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.

3 participants