]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
imap: add a check for Curl_meta_get()
authorDaniel Stenberg <daniel@haxx.se>
Tue, 3 Feb 2026 16:11:04 +0000 (17:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 3 Feb 2026 22:24:06 +0000 (23:24 +0100)
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

index df7a54f2b4977fa8d47fa87b12e280c930da56af..414ee32466d374da767cfc38ac55da587d6770be 100644 (file)
@@ -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)) {