]> diplodocus.org Git - nmh/commitdiff
imaptest.c: Don't test possibly uninitialised local variable.
authorRalph Corderoy <ralph@inputplus.co.uk>
Fri, 27 Oct 2017 12:44:26 +0000 (13:44 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Fri, 27 Oct 2017 14:08:34 +0000 (15:08 +0100)
get_imap_response() doesn't necessarily set the content of a non-NULL
`char **status'.  Do this before calling, and check if it's been set to
non-NULL before using upon return.

uip/imaptest.c

index 0e721ce..8d3bccb 100644 (file)
@@ -597,6 +597,7 @@ imap_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
      */
 
     case NETSEC_SASL_FINISH:
+        line = NULL;
        if (get_imap_response(nsc, NULL, NULL, &line, 1, errstr) != OK)
            return NOTOK;
        /*
@@ -604,7 +605,7 @@ imap_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
         * parse it.
         */
 
-       if (has_prefix(line, "OK [CAPABILITY ")) {
+       if (line && has_prefix(line, "OK [CAPABILITY ")) {
            char *p = line + 15, *q;
            q = strchr(p, ']');