From 0b35617a150b2b6a768c3bc575eff4ef1bbb2c03 Mon Sep 17 00:00:00 2001 From: fatbob313 Date: Wed, 3 Nov 2010 08:29:05 +0000 Subject: [PATCH] Fix potential segfault at checking server password when debugging enabled --- src/messagehandler.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/messagehandler.c b/src/messagehandler.c index d20ccba..4111d49 100644 --- a/src/messagehandler.c +++ b/src/messagehandler.c @@ -104,11 +104,14 @@ void Mh_handle_message(client_t *client, message_t *msg) } } if (strlen(getStrConf(PASSPHRASE)) > 0) { - if (!msg->payload.authenticate->password || strncmp(getStrConf(PASSPHRASE), msg->payload.authenticate->password, MAX_TEXT) != 0) { + if (!msg->payload.authenticate->password || + (msg->payload.authenticate->password && + strncmp(getStrConf(PASSPHRASE), msg->payload.authenticate->password, MAX_TEXT) != 0)) { char buf[64]; sprintf(buf, "Wrong server password"); sendServerReject(client, buf, MUMBLE_PROTO__REJECT__REJECT_TYPE__WrongServerPW); - Log_debug("Wrong server password: %s", msg->payload.authenticate->password); + Log_debug("Wrong server password: '%s'", msg->payload.authenticate->password != NULL ? + msg->payload.authenticate->password : "(null)"); goto disconnect; } } -- 2.30.2