Follow me on twitter

Ticket #378 (closed segfault: fixed)

Opened 3 years ago

Last modified 15 months ago

Some IRCDs do not return 005 on VERSION, breaks restart

Reported by: bryan Owned by: bryan
Priority: major Milestone: 1.2.16
Component: irc Version: 1.2.14
Keywords: ircnet 005 freenode restart Cc:

Description

This leads to many variables becoming uninitialized as 005 is only sent on connect, not VERSION.

Change History

Changed 3 years ago by bryan

(gdb) bt
#0  0x0809b17d in _rfc_casecmp (s1=0x40803 <Address 0x40803 out of bounds>, s2=0xbfbfddc0 "tiscali") at _rfc1459.c:24
#1  0x080c9167 in real_add_mode (chan=0x81a3800, plus=43 '+', mode=111 'o', op=0xbfbfddc0 "tiscali", cookie=true) at mode.c:438
#2  0x080c8056 in do_op (nick=0xbfbfddc0 "tiscali", chan=0x81a3800, delay=0, force=true) at mode.c:121
#3  0x080d7dc1 in getin_request (botnick=0x81a5da0 "tiscali", code=0xbfbfdff0 "gi", par=0x8158696 "") at ../irc.mod/irc.c:581
#4  0x080a1d01 in bind_entry_exec (table=0x8158180, entry=0x819b700, al=0xbfbfdea4) at _tclhash.c:318
#5  0x080a2092 in bind_vcheck_hits (table=0x8158180, match=0xbfbfdff0 "gi", flags=0x0, hits=0x0, ap=0xbfbfdf28 "") at _tclhash.c:440
#6  0x080a1e2a in check_bind (table=0x8158180, match=0xbfbfdff0 "gi", flags=0x0) at _tclhash.c:358
#7  0x08073e6c in check_bind_bot (nick=0xbfbfdfe2 "tiscali", code=0xbfbfdff0 "gi", param=0xbfbfdff3 "o #lunarshells tiscali")
    at _core_binds.c:241
#8  0x08051c24 in bot_zapf (idx=0, par=0xbfbfdff3 "o #lunarshells tiscali") at _botcmd.c:874
#9  0x0807aaa1 in dcc_bot (idx=0, code=0xbfbfdfe0 "z", i=35) at _dcc.c:475
#10 0x0808dab1 in main (argc=3, argv=0xbfbfe850) at _main.c:960

Crash is evident when viewing the code in real_add_mode: {{{

for (i = 0; i < (modesperline - 1); i++)

if (chan->ccmode[i].op != NULL && !rfc_casecmp(chan->ccmode[i].op, op))

return; /* Already in there :- duplicate */

}}}

Revealing i:

#1  0x080c9167 in real_add_mode (chan=0x81a3800, plus=43 '+', mode=111 'o', op=0xbfbfddc0 "tiscali", cookie=true) at mode.c:438
        mx = (memberlist *) 0x81ab400
        type = 5
        modes = 135962658
        len = 0
        i = 14
        m = (masklist *) 0x0
        s = '\0' <repeats 20 times>

14? modesperline is:

(gdb) print modesperline
$5 = 0

means modesperline - 1 = huge number = huge loop.

Problem exists in that during restart, VERSION is sent to server to grab 005 information. Maybe queueing this in the socksfile is a better solution to avoid anything like this or race condition segfaults.

Changed 15 months ago by bryan

  • keywords freenode restart added
  • summary changed from IRCNET does not return 005 on VERSION, breaks restart to Some IRCDs do not return 005 on VERSION, breaks restart

Changed 15 months ago by bryan

  • milestone set to 1.2.16

Changed 15 months ago by Bryan Drewery

  • status changed from new to closed
  • resolution set to fixed

* Update doc to reflect that segfault has been fixed from missing 005 on restart (fixes #378)

Changeset: 4cf34eba050e48cf5a0ef520e49d8ac0bf5edc83

Changed 15 months ago by Bryan Drewery

Merge branch 'cache-005'

* cache-005:

  • Fix cached_005 not being initialized
  • Only replay cache if it exists
  • Send VERSION if the 005 was not cached for some reason
  • Update doc to reflect that segfault has been fixed from missing 005 on restart (fixes #378)
  • Write cache out to socksfile and finish replaying
  • Fix cache on got005 to use 005
  • Replay server cache on restart
  • Cache with a nick of '.' since it is ignored and to prevent double msgs
  • Don't cache double msgs
  • Cache 005 into DP_CACHE
  • Add DP_CACHE for caching server information for use after restart

Conflicts:

doc/UPDATES

Changeset: e9cb226081987445bf547dd9da262ff92d54b449

Note: See TracTickets for help on using tickets.