Skip to content

Commit

Permalink
Check if auth_user is set.
Browse files Browse the repository at this point in the history
Fixes a crash if password packet appears before startup packet (#42).
  • Loading branch information
markokr committed Apr 8, 2015
1 parent 31bedb6 commit edab5be
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/client.c
Expand Up @@ -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;
Expand Down

0 comments on commit edab5be

Please sign in to comment.