summaryrefslogtreecommitdiffstats
path: root/pimd/pim_mroute.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-12-22 02:19:47 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-12-22 19:34:40 +0100
commitf08e6750740b1152fc140868213f66aa79e1d00a (patch)
tree060fa3249a97877580bdbc965ebd59d68a8b51d5 /pimd/pim_mroute.c
parentMerge pull request #5567 from opensourcerouting/bring-them-back (diff)
downloadfrr-f08e6750740b1152fc140868213f66aa79e1d00a.tar.xz
frr-f08e6750740b1152fc140868213f66aa79e1d00a.zip
pimd: readd iph length checks
Kernel might not hand us a bad packet, but better safe than sorry here. Validate the IP header length field. Also adds an additional check that the packet length is sufficient for an IGMP packet, and a check that we actually have enough for an ip header at all. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_mroute.c')
-rw-r--r--pimd/pim_mroute.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 1fe2289a8..3459abbc1 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -590,6 +590,9 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
struct in_addr ifaddr;
struct igmp_sock *igmp;
+ if (buf_size < (int)sizeof(struct ip))
+ return 0;
+
ip_hdr = (const struct ip *)buf;
if (ip_hdr->ip_p == IPPROTO_IGMP) {