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 add_note() - Followup to #1763 #1759

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Feb 1, 2025

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Fix add_note()

Additional description (if needed):

Test cases demonstrating functionality (if applicable):

CFLAGS="-O0 -g3 -fsanitize=address,undefined" ./configure

Before:

.note CpgevlUVBdudySxBQErFYkoOBSabbVjuiLvuPkpvFjSZpWvcoomkbSoqPDLKwckeatNBMXuhjyJwwktER: a
[14:37:05] tcl: builtin dcc call: *dcc:note -HQ 1 CpgevlUVBdudySxBQErFYkoOBSabbVjuiLvuPkpvFjSZpWvcoomkbSoqPDLKwckeatNBMXuhjyJwwktER: a
=================================================================
==197765==ERROR: AddressSanitizer

After:

.note CpgevlUVBdudySxBQErFYkoOBSabbVjuiLvuPkpvFjSZpWvcoomkbSoqPDLKwckeatNBMXuhjyJwwktER: a
[06:02:24] tcl: builtin dcc call: *dcc:note -HQ 1 CpgevlUVBdudySxBQErFYkoOBSabbVjuiLvuPkpvFjSZpWvcoomkbSoqPDLKwckeatNBMXuhjyJwwktER: a
[06:02:24] add_note(): sock not a number
.note 424242424242424242424242424242424242424242424242424242424242424242424242424242424: a
[06:02:28] tcl: builtin dcc call: *dcc:note -HQ 1 424242424242424242424242424242424242424242424242424242424242424242424242424242424: a
[06:02:28] add_note(): sock out of range
.note 42: a
[06:02:35] tcl: builtin dcc call: *dcc:note -HQ 1 42: a
I don't know anyone by that name.

@michaelortmann michaelortmann changed the title Fix add_note() Crashfix add_note() Feb 1, 2025
@michaelortmann michaelortmann changed the title Crashfix add_note() Fix add_note() - Followup to #1763 Feb 2, 2025
@@ -528,6 +528,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr
/* 324 - 327 */
#define find_member_from_nick ((memberlist * (*) (char *))global[324])
#define get_user_from_member ((struct userrec * (*) (memberlist *))global[325])
#define splitcn ((void (*)(char *, char *, char, size_t))global[326])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is one of these actually const char ptr as the input?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none of the char * params. the 3rd paramter char could be const. but i dont see any benefit in
splitcn ((void (*)(char *, char *, const char, size_t)
do you?

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