From: Ralph Corderoy Date: Fri, 27 Oct 2017 12:44:26 +0000 (+0100) Subject: imaptest.c: Don't test possibly uninitialised local variable. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/da665985decffc0a5c7bed784f225d2972782bcd?ds=inline imaptest.c: Don't test possibly uninitialised local variable. 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. --- diff --git a/uip/imaptest.c b/uip/imaptest.c index 0e721ce2..8d3bccb7 100644 --- a/uip/imaptest.c +++ b/uip/imaptest.c @@ -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, ']');