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

Replace sprintf with snprintf #20

Merged
merged 1 commit into from
Jul 27, 2024
Merged

Replace sprintf with snprintf #20

merged 1 commit into from
Jul 27, 2024

Conversation

jouae
Copy link
Collaborator

@jouae jouae commented Jul 26, 2024

In C99 7.19.6.5 sprintf, "If copying takes place between objects that overlap, the behavior is undefined".

Replace sprintf with snprintf and provide a clear buffer size to ensure undefined behavior does not occur.

And the sizeof(buff) + 1 includes the null terminator.

In C99 7.19.6.5 sprintf, "If copying takes place between objects
that overlap, the behavior is undefined".

Replace sprintf with snprintf and provide a clear buffer size to
ensure undefined behavior does not occur.

And the sizeof(buff) + 1 includes the null terminator.
@jserv jserv merged commit 015045c into sysprog21:main Jul 27, 2024
3 checks passed
@jserv
Copy link
Contributor

jserv commented Jul 27, 2024

Thank @jouae for contributing!

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