From fdca2e0fd38ca4110dd62d7f46d6c3fcce4a9fc5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Feb 2026 17:11:04 +0100 Subject: [PATCH] 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 --- lib/imap.c | 3 +++ 1 file changed, 3 insertions(+) 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)) {