Correct UNLINK_EXPR_SLIST() when the list is empty.
bk: 6491f2e9h9dRK-n2x5FjCsRYlDjiZQ
+---
+* [Bug 3837] NULL pointer deref crash when ntpd deletes last interface.
+ Reported by renmingshuai. Correct UNLINK_EXPR_SLIST() when the
+ list is empty. <hart@ntp.org>
+
---
(4.2.8p17) 2023/06/06 Released by Harlan Stenn <stenn@ntp.org>
#define UNLINK_EXPR_SLIST(punlinked, listhead, expr, nextlink, \
entrytype) \
-do { \
+if (NULL != (listhead)) { \
entrytype **ppentry; \
\
ppentry = &(listhead); \
} else { \
(punlinked) = NULL; \
} \
+} else do { \
+ (punlinked) = NULL; \
} while (FALSE)
#define UNLINK_SLIST(punlinked, listhead, ptounlink, nextlink, \