Skip to content

Commit

Permalink
imap-login: Fix crash in ID if trusted client sends NIL value to inte…
Browse files Browse the repository at this point in the history
…rnal field

Fixes:
Panic: imap-login: file imap-login-client.c: line 215 (cmd_id_handle_keyvalue): assertion failed: (client_id_str == !client_id_reserved_word(key))
  • Loading branch information
sirainen authored and GitLab committed Jun 14, 2017
1 parent df74814 commit fa7d402
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/imap-login/imap-login-client.c
Expand Up @@ -175,9 +175,7 @@ static bool
client_update_info(struct imap_client *client,
const char *key, const char *value)
{
/* do not try to process NIL value */
if (value == NULL)
return FALSE;
i_assert(value != NULL);

/* SYNC WITH imap_login_reserved_id_keys */

Expand Down Expand Up @@ -224,7 +222,10 @@ static void cmd_id_handle_keyvalue(struct imap_client *client,
size_t kvlen = strlen(key) + 2 + 1 +
(value == NULL ? 3 : strlen(value)) + 2;

if (client->common.trusted && !client->id_logged) {
if (value == NULL) {
/* do not try to process NIL value */
client_id_str = FALSE;
} else if (client->common.trusted && !client->id_logged) {
client_id_str = !client_update_info(client, key, value);
i_assert(client_id_str == !client_id_reserved_word(key));
} else {
Expand Down

0 comments on commit fa7d402

Please sign in to comment.