File 0001-Fixed-crash-on-0-pointer-access-in-mupdate.c.patch of Package cyrus-imapd-3

From 49a6571f495c731796ab31f7cefca317d8e3e19a Mon Sep 17 00:00:00 2001
From: Christian Mollekopf <mollekopf@apheleia-it.ch>
Date: Fri, 5 May 2023 09:19:35 +0200
Subject: [PATCH] Fixed crash on 0 pointer access in mupdate.c

We can't check the location of the mailbox if it doesn't exist.
This means we can't really suppress the DOESNTEXIST message,
but I don't know if this is a problem in reality.
---
 imap/mupdate.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/imap/mupdate.c b/imap/mupdate.c
index 2cc2571bc..8d4f92415 100644
--- a/imap/mupdate.c
+++ b/imap/mupdate.c
@@ -1629,7 +1629,7 @@ static void cmd_set(struct conn *C,
              * deactivation twice. Suppress bailing out on the second one
              * (the replica).
              */
-            if (strcmp(m->location, location)) {
+            if (m && strcmp(m->location, location)) {
                 /* failed; mailbox not currently active */
                 msg = NOTACTIVE;
                 goto done;
@@ -1643,15 +1643,9 @@ static void cmd_set(struct conn *C,
         if (!m) {
             /* Check if we run in a discrete murder topology */
             if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD) {
-                /* Replicated backends with the same server name issue
-                 * deletion twice. Suppress bailing out on the second one
-                 * (the replica).
-                 */
-                if (strcmp(m->location, location)) {
-                    /* failed; mailbox doesn't exist */
-                    msg = DOESNTEXIST;
-                    goto done;
-                }
+                /* failed; mailbox doesn't exist */
+                msg = DOESNTEXIST;
+                goto done;
             }
             /* otherwise do nothing (local delete on master) */
         } else {
-- 
2.40.0