Skip to content

Cleanup irc.mod / string copy - #1134

Closed
michaelortmann wants to merge 6 commits into
eggheads:developfrom
michaelortmann:simplify
Closed

michaelortmann wants to merge 6 commits into
eggheads:developfrom
michaelortmann:simplify

Conversation

@michaelortmann

@michaelortmann michaelortmann commented Feb 26, 2021 •

Copy link
Copy Markdown
Member

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Cleanup irc.mod / string copy

Additional description (if needed):

Test cases demonstrating functionality (if applicable):
No functional change.

@thommey

thommey commented Aug 22, 2021

Copy link
Copy Markdown
Member

This isn't a simple cleanup, it's a change in behavior. newsplit modifies its argument string to split it, removing this buffer makes the functions modify the input.

@michaelortmann

Copy link
Copy Markdown
Member Author

thats fine. the parameter is modifyable. we dont need to copy before newsplit(). other functions in chan.c call newsplit() on the parameter without such copy also. example: https://github.com/eggheads/eggdrop/blob/develop/src/mod/irc.mod/chan.c#L1192

@thommey

thommey commented Aug 13, 2023

Copy link
Copy Markdown
Member

It still has side-effects I have seen in the past, e.g. raw console log being mangled.
It might be warranted to always give the bind handler a copy of this string instead of the real raw string.

@michaelortmann

Copy link
Copy Markdown
Member Author

Some bind functions dont copy the origmsg and modify it. Some copy it before modifying. I see no problems in modifying without copy, so would strip all local copies. You seen problems without copy, so you would like to copy for all binds in advance. We could indeed argue to strip all local copies in favor of letting the bind call make the copy before calling the bind. In each case, i would like to see a general solution instead of the current state where sometimes its copied and sometimes its not.

Anyway, for now i opted to simplify this PR, to just replace strncpy value with strlcpy sizeof.

@vanosg

vanosg commented Sep 25, 2026

Copy link
Copy Markdown
Member

@thommey LGTM... any issues with what is left here

@vanosg vanosg added this to the 1.10.3 milestone Sep 25, 2026
@michaelortmann

Copy link
Copy Markdown
Member Author

Obsolete by events. #1753 fixed this already.

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.

3 participants