commit fd872a7ff7078c76fa255305c630258d02934d49
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sat Apr 12 14:58:18 2014 +0200

    don't crash on truncated LIST response
    
    found by coverity.

 src/drv_imap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index fbb8817..98f23ba 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -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 );

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to