don't crash on malformed CAPABILITY responses

amends 95a83c822.

this problem was found by Lukas Braun <koomi@moshbit.net> using a
fuzzer.
This commit is contained in:
Oswald Buddenhagen 2021-04-14 16:52:31 +02:00
parent d8feb67dae
commit a86e6f8c7c

View File

@ -1273,7 +1273,7 @@ parse_response_code( imap_store_t *ctx, imap_cmd_t *cmd, char *s )
return RESP_CANCEL; return RESP_CANCEL;
} }
} else if (!strcmp( "CAPABILITY", arg )) { } else if (!strcmp( "CAPABILITY", arg )) {
if (!(p = strchr( s, ']' ))) { if (!s || !(p = strchr( s, ']' ))) {
error( "IMAP error: malformed CAPABILITY status\n" ); error( "IMAP error: malformed CAPABILITY status\n" );
return RESP_CANCEL; return RESP_CANCEL;
} }