Skip to content

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