ntp/backport-add-NULL-pointer-check-when-ntpd-deletes-the-last-interface.patch
2023-06-21 14:52:46 +08:00

38 lines
1.0 KiB
Diff

From 6f92672308e9ff2ff72f1d929b6887ab24787e42 Mon Sep 17 00:00:00 2001
From: Harlen Stenn <stenn@ntp.org>
Date: Tue, 20 Jun 2023 18:41:55 +0000
Subject: [PATCH] add NULL pointer check when ntpd deletes the last interface
Conflict:NA
Reference:https://bugs.ntp.org/attachment.cgi?id=1854&action=diff
---
include/ntp_lists.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/ntp_lists.h b/include/ntp_lists.h
index d741974..37befc0 100644
--- a/include/ntp_lists.h
+++ b/include/ntp_lists.h
@@ -181,7 +181,7 @@ do { \
#define UNLINK_EXPR_SLIST(punlinked, listhead, expr, nextlink, \
entrytype) \
-do { \
+if (NULL != (listhead)) { \
entrytype **ppentry; \
\
ppentry = &(listhead); \
@@ -202,6 +202,8 @@ do { \
} else { \
(punlinked) = NULL; \
} \
+} else do { \
+ (punlinked) = NULL; \
} while (FALSE)
#define UNLINK_SLIST(punlinked, listhead, ptounlink, nextlink, \
--
2.27.0