(WIP) Fix snprintf with overlapping source and dest strings #1062
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Found by: Will Buckner and michaelortmann
Patch by: michaelortmann
Fixes: #1061
One-line summary:
Fix snprintf with overlapping source and dest strings
Additional description (if needed):
This looks like another bug in the code:
eggdrop/src/mod/server.mod/server.c
Line 589 in 5182a22
shouldnt nick be appended instead?
%s,%s
instead of,%s?
Another line looks glitchy:
eggdrop/src/mod/server.mod/server.c
Line 583 in 5182a22
Here strlen(newnick) is calculated. But later:
eggdrop/src/mod/server.mod/server.c
Line 585 in 5182a22
there is a check for newnick is NULL.
This doesnt make sense, does it?
We really need to come up with a good test for function parse_q() to make sure, the code works as expected. I think this function is buggy in its current state.
If there is indeed a bug it would effect eggdrop when
optimize_kicks == 2
is set.The alleged bug was introduced when optimize-kicks was added to eggdrop:
643554c#diff-917cd0562d3c81d827ab3b993432429b4433293a25e4090c1bda6823b705e4f2R539 in eggdrop 1.5.2
Test cases demonstrating functionality (if applicable):
I dont have real world test yet. Thats why this PR is still marked as WIP.