eggheads / eggdrop

The Eggdrop IRC Bot
GNU General Public License v2.0
510 stars 84 forks source link

Crash fix: strcpy-param-overlap #1613

Open michaelortmann opened 5 months ago

michaelortmann commented 5 months ago

Found by: michaelortmann Patch by: michaelortmann Fixes:

One-line summary: Fix strcpy-param-overlap (AddressSanitizer crash)

Additional description (if needed): Also revert bug introduced by #1157

Test cases demonstrating functionality (if applicable): Test 1

.files
.cd ../../
=================================================================
==100130==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x502000035d70,0x502000035d75) and [0x502000035d73, 0x502000035d78) overlap
    #0 0x777c8f6f5ccd in strcpy /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:561
    #1 0x777c89ccafc6 in resolve_dir .././filesys.mod/files.c:174
[...]

Test2

[16:15:06] [@] :testuser!michael@Clk-8553FB0D MODE #test +l 1000000
[16:15:06] #test: mode change '+l 1000000' by testuser!michael@Clk-8553FB0D
[16:15:14] [@] :testuser!michael@Clk-8553FB0D MODE #test +k 9a
[16:15:14] #test: mode change '+k 9a' by testuser!michael@Clk-8553FB0D
.reset
[16:15:19] tcl: builtin dcc call: *dcc:reset -HQ 1 
[16:15:19] #-HQ# reset all
Resetting channel info for all channels...
[16:15:19] [!m] MODE #test +b
[16:15:19] [m->] MODE #test +b
[16:15:19] [!m] MODE #test +e
[16:15:19] [m->] MODE #test +e
[16:15:19] [!m] MODE #test +I
[16:15:19] [m->] MODE #test +I
[16:15:19] [!m] MODE #test
[16:15:19] [m->] MODE #test
[16:15:19] [!m] WHO #test c%chnufat,222
[16:15:19] [!m] TOPIC #test
[16:15:19] [@] :irc.example.org 368 BotA #test :End of Channel Ban List
[16:15:19] [@] :irc.example.org 349 BotA #test :End of Channel Exception List
[16:15:19] [@] :irc.example.org 347 BotA #test :End of Channel Invite List
[16:15:19] [@] :irc.example.org 324 BotA #test +klnt 9a 1000000
=================================================================
==153831==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x5290000ca0a1,0x5290000ca0a9) and [0x5290000ca0a4, 0x5290000ca0ac) overlap
    #0 0x736df12f5ccd in strcpy /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:561
    #1 0x736dec143bda in got324 .././irc.mod/chan.c:1035