diff options
| author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2018-06-14 10:29:35 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-14 10:29:35 -0300 |
| commit | ff456781b7918cc4565127a3f3db62d40ff02766 (patch) | |
| tree | e5d0d6b040edd14d2131091240f8256fe128baa1 /lib/prefix.c | |
| parent | 447c4754a1546f4834e340c60d675af87c815c71 (diff) | |
| parent | f0ed6beaf20a3c0b12c18c86e0b1e3a6572e1add (diff) | |
Merge pull request #2410 from pacovn/Coverity_1448806_Out-of-bounds_access
lib: Out-of-bounds access (Coverity 1448806, 1448810)
Diffstat (limited to 'lib/prefix.c')
| -rw-r--r-- | lib/prefix.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index ead5444fd0..ed0774e774 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -584,8 +584,8 @@ int prefix_match(const struct prefix *n, const struct prefix *p) } /* Set both prefix's head pointer. */ - np = (const uint8_t *)&n->u.prefix; - pp = (const uint8_t *)&p->u.prefix; + np = n->u.val; + pp = p->u.val; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -609,8 +609,8 @@ int prefix_match_network_statement(const struct prefix *n, const uint8_t *np, *pp; /* Set both prefix's head pointer. */ - np = (const uint8_t *)&n->u.prefix; - pp = (const uint8_t *)&p->u.prefix; + np = n->u.val; + pp = p->u.val; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -742,8 +742,8 @@ int prefix_cmp(const struct prefix *p1, const struct prefix *p2) return 1; return 0; } - pp1 = (const uint8_t *)&p1->u.prefix; - pp2 = (const uint8_t *)&p2->u.prefix; + pp1 = p1->u.val; + pp2 = p2->u.val; if (p1->prefixlen != p2->prefixlen) return 1; @@ -774,8 +774,8 @@ int prefix_common_bits(const struct prefix *p1, const struct prefix *p2) uint8_t xor ; /* Set both prefix's head pointer. */ - const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix; - const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix; + const uint8_t *pp1 = p1->u.val; + const uint8_t *pp2 = p2->u.val; if (p1->family == AF_INET) length = IPV4_MAX_BYTELEN; |
