Skip to content

Use proper buffer size in tt_user.c's digit_suffix #582

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: dev
Choose a base branch
from

Conversation

doismellburning
Copy link

Modern Ubuntu (e.g. GitHub Actions' ubuntu-latest), among other distros, compiles with -D_FORTIFY_SOURCE=3 which does neat things like checking strlcpy won't overflow.

tt_user_s has a char digit_suffix[3+1], so when attempting to strlcpy into it with length 5, this triggers a buffer overflow error for safety reasons (even though the source string only has length 4)

Let's instead pass a size to digit_suffix and use that.

Modern Ubuntu (e.g. GitHub Actions' `ubuntu-latest`), among other
distros, compiles with `-D_FORTIFY_SOURCE=3` which does neat things like
checking `strlcpy` won't overflow.

`tt_user_s` has a `char digit_suffix[3+1]`, so when attempting to
`strlcpy` into it with length 5, this triggers a buffer overflow error
for safety reasons (even though the source string only has length 4)

Let's instead pass a size to `digit_suffix` and use that.
doismellburning added a commit to doismellburning/samoyed that referenced this pull request Jul 19, 2025
Incorporates the digit_suffix buffer length fix from
wb2osz/direwolf#582 to avoid buffer overflow
assertions when running with -D_FORTIFY_SOURCE=3
@doismellburning
Copy link
Author

Note that this was found by running the test in tt_user.c - I think it would probably be good if this were run automatically

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