1From 14cc53bb09a3d8adf301f3842c765598467e63e1 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Thu, 1 Feb 2024 14:07:03 +0000
4Subject: [PATCH] Fix SIGSEGV during DumpStateLog()
5
6DumpStateLog() calls LogMsgWithLevelv() with category == NULL, avoid
7crashing in this case.
8
9Upstream-Status: Inactive-Upstream [Upstream does not take patches]
10Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
11---
12 mDNSShared/mDNSDebug.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/mDNSShared/mDNSDebug.c b/mDNSShared/mDNSDebug.c
16index 7a4ca19eff6d..d449dde320f6 100644
17--- a/mDNSShared/mDNSDebug.c
18+++ b/mDNSShared/mDNSDebug.c
19@@ -71,7 +71,7 @@ mDNSlocal void LogMsgWithLevelv(os_log_t category, os_log_type_t level, const ch
20 mDNSlocal void LogMsgWithLevelv(const char *category, mDNSLogLevel_t level, const char *format, va_list args)
21 {
22     // Do not print the logs if the log category is MDNS_LOG_CATEGORY_DISABLED.
23-    if (strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0)
24+    if (category && strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0)
25     {
26         return;
27     }
28--
292.39.0
30
31