eggheads / eggdrop

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

Crashfix: PART #1709

Open michaelortmann opened 3 weeks ago

michaelortmann commented 3 weeks ago

Found by: BigBadWouf Patch by: michaelortmann Fixes: #1708

One-line summary: Crashfix gotpart(): If ismember() returns 0, fallback to get_user_by_host()

Additional description (if needed): ismember() can returns 0 while the bot has not (yet) synched the channel, like when it just joined This bug affects eggdrop version 1.10.0, older versions are not affected

Test cases demonstrating functionality (if applicable): Fixes the following crash:

[22:08:48] [@] :testuser!~michael@localhost PART #test666
[22:08:48] * Please report problem to https://github.com/eggheads/eggdrop/issues
[22:08:48] * Check doc/BUG-REPORT on how to do so.
[22:08:48] * Last bind (may not be related): evnt:init_server
[22:08:48] * Wrote DEBUG
[22:08:48] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)
BigBadWouf commented 3 weeks ago

Hi,

Thank you, this perfectly fix the /part crash. However it's seem produce a lot call to killmember(). Don't know if related

michaelortmann commented 3 weeks ago

Good find. The killmember() was already called before the regression.

So now, additionally this PR avoids calling killmember() if we just checked that the parting entity is not ismember()

ismember() already checks the very channel memberlist that killmember() would search through again.