From ad771372ac3f2f649a9f3f300c2d51a4701ad9ea Mon Sep 17 00:00:00 2001 From: Alex Legler Date: Thu, 9 Sep 2010 16:37:43 +0200 Subject: [PATCH] Check LINK(lc) before using it to avoid a null-pointer dereference (CVE-2010-3071) --- src/irc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/irc.c b/src/irc.c index fa98e09..c5f65a2 100644 --- a/src/irc.c +++ b/src/irc.c @@ -2449,7 +2449,7 @@ void bip_on_event(bip_t *bip, connection_t *conn) if (err) { if (TYPE(lc) == IRC_TYPE_SERVER) { mylog(LOG_ERROR, "[%s] read_lines error, closing...", - LINK(lc)->name); + LINK(lc) ? LINK(lc)->name : "?"); irc_server_shutdown(LINK(lc)->l_server); } else { mylog(LOG_ERROR, "client read_lines error, closing..."); @@ -2471,7 +2471,7 @@ void bip_on_event(bip_t *bip, connection_t *conn) line = irc_line_new_from_string(line_s); if (!line) { mylog(LOG_ERROR, "[%s] Error in protocol, closing...", - LINK(lc)->name); + LINK(lc) ? LINK(lc)->name : "?"); free(line_s); goto prot_err_lines; } @@ -2481,7 +2481,7 @@ void bip_on_event(bip_t *bip, connection_t *conn) free(line_s); if (r == ERR_PROTOCOL) { mylog(LOG_ERROR, "[%s] Error in protocol, closing...", - LINK(lc)->name); + LINK(lc) ? LINK(lc)->name : "?"); goto prot_err_lines; } if (r == ERR_AUTH) -- 1.7.2