From: Timo Sirainen Date: Wed, 14 Jun 2017 07:50:38 +0000 (+0300) Subject: imap-login: Fix crash in ID if trusted client sends NIL value to internal field X-Git-Tag: 2.3.0.rc1~1414 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa7d4026316cfa6fcd084487d895743c79bd7ec6;p=thirdparty%2Fdovecot%2Fcore.git imap-login: Fix crash in ID if trusted client sends NIL value to internal 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)) --- diff --git a/src/imap-login/imap-login-client.c b/src/imap-login/imap-login-client.c index d6a3098e29..317113bfb4 100644 --- a/src/imap-login/imap-login-client.c +++ b/src/imap-login/imap-login-client.c @@ -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 */ @@ -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 {