don't crash on truncated LIST response

found by coverity.
This commit is contained in:
Oswald Buddenhagen 2014-04-12 14:58:18 +02:00
parent 0dfbf6f6fb
commit fd872a7ff7

View File

@ -1040,8 +1040,9 @@ parse_list_rsp( imap_store_t *ctx, list_t *list, char *cmd )
list_t *lp;
if (!is_list( list )) {
error( "IMAP error: malformed LIST response\n" );
free_list( list );
bad_list:
error( "IMAP error: malformed LIST response\n" );
return LIST_BAD;
}
for (lp = list->child; lp; lp = lp->next)
@ -1050,7 +1051,8 @@ parse_list_rsp( imap_store_t *ctx, list_t *list, char *cmd )
return LIST_OK;
}
free_list( list );
arg = next_arg( &cmd );
if (!(arg = next_arg( &cmd )))
goto bad_list;
if (!ctx->delimiter)
ctx->delimiter = nfstrdup( arg );
return parse_list( ctx, cmd, parse_list_rsp_p2 );