summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2020-04-06 20:26:13 +0200
committerGitHub <noreply@github.com>2020-04-06 20:26:13 +0200
commit6b1d9f37ec25399bbbb0bfc1c2e33d35877b5c35 (patch)
tree44181a25ee2232f08e327bc5b467f594fc21e0e5 /pimd
parentMerge pull request #6150 from ton31337/feature/black_topotests_developer_guide (diff)
parentpimd: fix negative bitshift (diff)
downloadfrr-6b1d9f37ec25399bbbb0bfc1c2e33d35877b5c35.tar.xz
frr-6b1d9f37ec25399bbbb0bfc1c2e33d35877b5c35.zip
Merge pull request #6160 from qlyoung/fix-pim-bsm-negative-shift
pimd: fix negative bitshift in BSM code
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_bsm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index ad4742710..d949c657b 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -1282,6 +1282,13 @@ int pim_bsm_process(struct interface *ifp, struct ip *ip_hdr, uint8_t *buf,
bshdr = (struct bsm_hdr *)(buf + PIM_MSG_HEADER_LEN);
pim_inet4_dump("<bsr?>", bshdr->bsr_addr.addr, bsr_str,
sizeof(bsr_str));
+ if (bshdr->hm_len > 32) {
+ zlog_warn("Bad hashmask length for IPv4; got %" PRIu8
+ ", expected value in range 0-32",
+ bshdr->hm_len);
+ pim->bsm_dropped++;
+ return -1;
+ }
pim->global_scope.hashMasklen = bshdr->hm_len;
frag_tag = ntohs(bshdr->frag_tag);