]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
imap: add a check for failing strdup()
authorDaniel Stenberg <daniel@haxx.se>
Mon, 14 Aug 2023 11:43:33 +0000 (13:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 14 Aug 2023 16:07:12 +0000 (18:07 +0200)
lib/imap.c

index b8c220569ca5ad4e3bfb48c99c0c385c4c1f8cae..de64c2a7f26df420c0c66d2ae875e2f10dc54d41 100644 (file)
@@ -1115,7 +1115,10 @@ static CURLcode imap_state_select_resp(struct Curl_easy *data, int imapcode,
     }
     else {
       /* Note the currently opened mailbox on this connection */
+      DEBUGASSERT(!imapc->mailbox);
       imapc->mailbox = strdup(imap->mailbox);
+      if(!imapc->mailbox)
+        return CURLE_OUT_OF_MEMORY;
 
       if(imap->custom)
         result = imap_perform_list(data);