From: Daniel Stenberg Date: Tue, 3 Feb 2026 16:11:04 +0000 (+0100) Subject: imap: add a check for Curl_meta_get() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdca2e0fd38ca4110dd62d7f46d6c3fcce4a9fc5;p=thirdparty%2Fcurl.git imap: add a check for Curl_meta_get() It should not return NULL, but if it does we need to bail out. Like we do elsewhere.a Found by CodeSonar. Closes #20510 --- diff --git a/lib/imap.c b/lib/imap.c index df7a54f2b4..414ee32466 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1224,6 +1224,9 @@ static CURLcode imap_state_listsearch_resp(struct Curl_easy *data, size_t len = imapc->pp.nfinal; struct IMAP *imap = Curl_meta_get(data, CURL_META_IMAP_EASY); + DEBUGASSERT(imap); + if(!imap) + return CURLE_FAILED_INIT; (void)instate; if(imapcode == '*' && is_custom_fetch_listing(imap)) {