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

Fix snprintf buffer length limit #192

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

Conversation

yuyichao
Copy link
Contributor

The current limit of 17 is wrong since it is not the length of the buffer with the offset j. This causes a hardened build to fail.

The current limit of 17 is wrong since it is not the length of the buffer
with the offset `j`. This causes a hardened build to fail.
@IngoMeyer441
Copy link
Member

Thanks for the PR!

Which hardening flags did you use? It would be interesting to add those to our CI debug builds.

@yuyichao
Copy link
Contributor Author

It was the option that's enabled by default on ArchLinux. I believe it's -D_FORTIFY_SOURCE=3. You can find snprintf in the list at https://www.gnu.org/software/libc/manual/html_node/Source-Fortification.html, among other functions.

@IngoMeyer441
Copy link
Member

Ok, great thanks. I already pushed your commit to our CI, it will be automatically mirrored to GitHub in the next minutes. Hopefully, GitHub detects that your commit was already merged in.

@yuyichao
Copy link
Contributor Author

(And to be clear, if you want to add new options to the CI, by "fail" I meant a runtime failure. The build itself was successful but trying to generate a pdf will fail)

@IngoMeyer441
Copy link
Member

Ok, thanks for clarification. I added -D_FORTIFY_SOURCE=3 along with other flags from the OpenSSF recommendations to our Debug CI build. Now, our tests should catch the runtime errors caused by the checks.

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