]> arthur.barton.de Git - ngircd-alex.git/commit
Fix use-after-free while handling ERROR during client login
authorAlexander Barton <alex@barton.de>
Sun, 11 Mar 2018 20:06:03 +0000 (21:06 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 11 Mar 2018 20:18:38 +0000 (21:18 +0100)
commit798de94d6556bdf2c6019f368ad7441fe6e2d1be
tree6692960b76994def202db2eb015badf157e327ab
parentac341176da5bbe99a9b07353f6e9790575ce1493
Fix use-after-free while handling ERROR during client login

This patch fixes a "use after free" bug which is hit while processing
ERROR commands while a new client is logging into the server, which
leads to only the CLIENT structure becoming freed, but not the
CONNECTION structure, too. And this leads to the daemon accessing the
already freed CLIENT structure later on ...

So now IRC_ERROR() uses the correct function Conn_Close() to correctly
free both structures.

The CONNECTION structure is cleaned up later on, and the freed CLIENT
structure can't be overwritten during normal operations, therefore this
bug normally can't crash (DoS) the service -- but you can easily hit it
when using the GCC option "-fsanitize=address", or run ngIRCd with
Valgrind.

Thanks a lot to Joseph Bisch <joseph.bisch@gmail.com> for discovering
and reporting this issue!
src/ngircd/irc.c