Skip to content

Commit 618ec81

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f54c5bd commit 618ec81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imap-send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static int parse_response_code(struct imap_store *ctx, struct imap_cmd_cb *cb,
683683
struct imap *imap = ctx->imap;
684684
char *arg, *p;
685685

686-
if (*s != '[')
686+
if (!s || *s != '[')
687687
return RESP_OK; /* no response code */
688688
s++;
689689
if (!(p = strchr(s, ']'))) {

0 commit comments

Comments
 (0)