git: 153446e530b2 - stable/13 - sctp: improve robustness

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 23 Feb 2022 00:18:05 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=153446e530b2b1ceb18c3283c45e265febf8766a

commit 153446e530b2b1ceb18c3283c45e265febf8766a
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-02-18 13:30:07 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-23 00:16:36 +0000

    sctp: improve robustness
    
    (cherry picked from commit fd0d53f85c9f5d1a31367eb1b8b5e74cc83afd52)
---
 sys/netinet/sctp_os_bsd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h
index 7d5cef6d5f09..e8d08588fbfb 100644
--- a/sys/netinet/sctp_os_bsd.h
+++ b/sys/netinet/sctp_os_bsd.h
@@ -313,7 +313,7 @@ typedef struct callout sctp_os_timer_t;
 /*************************/
 /*      MTU              */
 /*************************/
-#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index) ((struct ifnet *)ifn)->if_mtu
+#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index) ((ifn != NULL) ? ((struct ifnet *)ifn)->if_mtu : 0)
 #define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, nh) ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0))
 
 /*************************/