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 format #1522

Merged
merged 1 commit into from
Feb 18, 2024
Merged

Fix format #1522

merged 1 commit into from
Feb 18, 2024

Conversation

michaelortmann
Copy link
Member

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Fix format for #1390

Additional description (if needed):
snprintf() -> strlcpy()

Test cases demonstrating functionality (if applicable):
Before:

clang -Wno-deprecated-non-prototype -g -O2 -pipe -Wall -I.. -I..  -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -c tclhash.c
tclhash.c:741:57: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
    snprintf(last_bind_called, sizeof last_bind_called, proc);
                                                        ^~~~
tclhash.c:741:57: note: treat the string as an argument to avoid this
    snprintf(last_bind_called, sizeof last_bind_called, proc);
                                                        ^
                                                        "%s", 
1 warning generated.

After:
clang -Wno-deprecated-non-prototype -g -O2 -pipe -Wall -I.. -I.. -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS -c tclhash.c
New test:
to test this PR, eggdrop has to crash, so i inserted
*(char *) 0xc0ffee = 1;
into cmd_die() to make it crash on .die:

.die
[22:34:36.%f] tcl: builtin dcc call: *dcc:die -HQ 1 
[22:34:36.%f] * Please report problem to https://github.com/eggheads/eggdrop/issues
[22:34:36.%f] * Check doc/BUG-REPORT on how to do so.
[22:34:36.%f] * Last bind (may not be related): evnt:init_server
[22:34:35.%f] * Wrote DEBUG
[22:34:35.%f] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

@vanosg vanosg added this to the v1.10.0 milestone Feb 18, 2024
@vanosg vanosg merged commit 5aabf4d into eggheads:develop Feb 18, 2024
2 checks passed
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