summaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-11-02 17:27:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-03 13:45:57 (GMT)
commit618ec81abbda91d867ac43320c7fd3e8fcc23e78 (patch)
treebd91a28d335a1694d854e4ef1852c749b0dfb25e /imap-send.c
parentf54c5bd40c0e215fc0ba196d74b092ef3ec02273 (diff)
downloadgit-618ec81abbda91d867ac43320c7fd3e8fcc23e78.zip
git-618ec81abbda91d867ac43320c7fd3e8fcc23e78.tar.gz
git-618ec81abbda91d867ac43320c7fd3e8fcc23e78.tar.bz2
imap-send: handle missing response codes gracefully
Response codes are optional. Exit parse_response_code() early if it's passed a NULL string, indicating that we reached the end of the reply. This avoids dereferencing said NULL pointer. Noticed-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'imap-send.c')
-rw-r--r--imap-send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c
index ffbf266..efa6af4 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -683,7 +683,7 @@ static int parse_response_code(struct imap_store *ctx, struct imap_cmd_cb *cb,
struct imap *imap = ctx->imap;
char *arg, *p;
- if (*s != '[')
+ if (!s || *s != '[')
return RESP_OK; /* no response code */
s++;
if (!(p = strchr(s, ']'))) {