summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_proto.c
diff options
context:
space:
mode:
authorpaco <paco@voltanet.io>2018-06-27 11:47:57 +0200
committerF. Aragon <paco@voltanet.io>2018-06-29 10:39:27 +0200
commitb8ce0c369622b5aeeef35a5ab4028d458bff4c92 (patch)
treeb7f401cd43dbe8e59697a8b6be210cd68ad81b7d /ospf6d/ospf6_proto.c
parentMerge pull request #2556 from pacovn/Coverity_1465491_Untrusted_value_as_argu... (diff)
downloadfrr-b8ce0c369622b5aeeef35a5ab4028d458bff4c92.tar.xz
frr-b8ce0c369622b5aeeef35a5ab4028d458bff4c92.zip
ospf6d: OoB read (Coverity 1221444 1221446)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'ospf6d/ospf6_proto.c')
-rw-r--r--ospf6d/ospf6_proto.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ospf6d/ospf6_proto.c b/ospf6d/ospf6_proto.c
index 4b56a64b7..864974c9a 100644
--- a/ospf6d/ospf6_proto.c
+++ b/ospf6d/ospf6_proto.c
@@ -24,6 +24,16 @@
#include "ospf6_proto.h"
+void ospf6_prefix_in6_addr(struct in6_addr *in6, const void *prefix_buf,
+ const struct ospf6_prefix *p)
+{
+ ptrdiff_t in6_off = (caddr_t)p->addr - (caddr_t)prefix_buf;
+
+ memset(in6, 0, sizeof(struct in6_addr));
+ memcpy(in6, (uint8_t *)prefix_buf + in6_off,
+ OSPF6_PREFIX_SPACE(p->prefix_length));
+}
+
void ospf6_prefix_apply_mask(struct ospf6_prefix *op)
{
uint8_t *pnt, mask;