From: Marko Kreen Date: Wed, 8 Apr 2015 06:22:55 +0000 (+0300) Subject: Check if auth_user is set. X-Git-Tag: pgbouncer_1_6~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edab5be6665b9e8de66c25ba527509b229468573;p=pgbouncer Check if auth_user is set. Fixes a crash if password packet appears before startup packet (#42). --- diff --git a/src/client.c b/src/client.c index 275fd1a..49b2624 100644 --- a/src/client.c +++ b/src/client.c @@ -39,6 +39,12 @@ static bool check_client_passwd(PgSocket *client, const char *passwd) const char *correct; PgUser *user = client->auth_user; + /* auth_user may be missing */ + if (!user) { + slog_error(client, "Password packet before auth packet?"); + return false; + } + /* disallow empty passwords */ if (!*passwd || !*user->passwd) return false;