Fix Tcl_TraceVar() / tcl_eggstr() modifying original tcl variable #1733
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: DasBrain
Patch by: michaelortmann
Fixes: #1544
One-line summary:
Fix
Tcl_TraceVar()
/tcl_eggstr()
Additional description (if needed):
This bug affects eggdrop since the dawn of time.
Eggdrop uses Tcl_TraceVar() when a tcl variable is set. In callback function
tcl_eggstr()
it truncates strings to their maximum length. The Bug is, that it modifies the original string here:eggdrop/src/tcl.c
Line 287 in 0f5599e
This PR fixes this, by modifying the destination string, when the original is copied to the destination here:
eggdrop/src/tcl.c
Line 299 in 0f5599e
There are a few special variables / handlers here:
eggdrop/src/tcl.c
Lines 288 to 298 in 0f5599e
It would make this PR too complex to also look into those and fix those cases. So this PR will fix all variables but the following 3:
Test cases demonstrating functionality (if applicable):
eggdrop.conf:
Before:
After: