direwolf icon indicating copy to clipboard operation
direwolf copied to clipboard

Use proper buffer size in tt_user.c's digit_suffix

Open doismellburning opened this issue 5 months ago • 1 comments

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 avatar Jul 19 '25 00:07 doismellburning

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

doismellburning avatar Jul 19 '25 00:07 doismellburning