]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: Fix coverity FORWARD_NULL for v->namelen in SNMP code 12517/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 14 Dec 2022 08:08:27 +0000 (10:08 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 14 Dec 2022 08:08:27 +0000 (10:08 +0200)
commit67116298cf7c791603a09faf1ddbe09eae3aba21
tree9143da13e9fb7824ef1274c7bc92940dd3ee1109
parent22e60ca210dd312de6394ea5fcb03630bb490c08
bgpd: Fix coverity FORWARD_NULL for v->namelen in SNMP code

```
*** CID 1529864:    (FORWARD_NULL)
/bgpd/bgp_snmp_bgp4v2.c: 443 in bgp4v2PathAttrLookup()
437
438     #define BGP_NLRI_ENTRY_OFFSET (afi_len + 1 + afi_len)
439
440             sockunion_init(&su);
441
442             if (exact) {
>>>     CID 1529864:    (FORWARD_NULL)
>>>     Dereferencing null pointer "v".
443                     if (*length - v->namelen != BGP_NLRI_ENTRY_OFFSET)
444                             return NULL;
445
446                     /* Set OID offset for prefix */
447                     offset = name + v->namelen;
448                     if (family == AF_INET)
/bgpd/bgp_snmp_bgp4v2.c: 480 in bgp4v2PathAttrLookup()
474                             bgp_dest_unlock_node(dest);
475                     }
476
477                     return NULL;
478             }
479
>>>     CID 1529864:    (FORWARD_NULL)
>>>     Dereferencing null pointer "v".
480             offset = name + v->namelen;
481             offsetlen = *length - v->namelen;
482             len = offsetlen;
483
484             if (offsetlen == 0) {
485                     dest = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]);
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_snmp_bgp4v2.c