Skip to content

Commit

Permalink
mod_chanserv: Add missing check for NULL mysql.
Browse files Browse the repository at this point in the history
Add check in channel_get_entrymsg to abort if mysql is NULL,
due to failing to connect to the database. Every other call
to mysql_stmt_init was preceded by such a check except this one,
which naturally was observed triggering some crashes.

LBBS-50 #close
  • Loading branch information
InterLinked1 committed Sep 14, 2024
1 parent f5aaeab commit d1ab07c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/mod_chanserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ static int channel_get_entrymsg(MYSQL_STMT *stmt, const char *channel, char *buf
if (!stmt) {
connlocal = 1;
mysql = sql_connect_db(buf_dbhostname, buf_dbusername, buf_dbpassword, buf_dbname);
NULL_RETURN(mysql);
stmt = mysql_stmt_init(mysql);
if (!stmt) {
goto cleanup;
Expand Down

0 comments on commit d1ab07c

Please sign in to comment.