]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Assign large enough data structure for coverity to be happy
authorDonald Sharp <sharpd@nvidia.com>
Thu, 12 May 2022 20:47:05 +0000 (16:47 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 12 May 2022 20:47:05 +0000 (16:47 -0400)
When implementing the bgp_packet_mpunreach_prefix a uint8_t array
of 3 bytes was created and then assigned to a label type, which
is 4 bytes and then various pointer work is done on it.  Eventually
coverity is complaining that the 3 -vs- 4 bytes is not enough
to properly dereference it.  Just make the uint8_t 4 bytes
and be done with it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_attr.c

index f45362f81164e16409f725078429c081ce20f495..61e7f2d67a9adcd2e28e439aee85a942f960071b 100644 (file)
@@ -4430,7 +4430,7 @@ void bgp_packet_mpunreach_prefix(struct stream *s, const struct prefix *p,
                                 bool addpath_capable, uint32_t addpath_tx_id,
                                 struct attr *attr)
 {
-       uint8_t wlabel[3] = {0x80, 0x00, 0x00};
+       uint8_t wlabel[4] = {0x80, 0x00, 0x00};
 
        if (safi == SAFI_LABELED_UNICAST) {
                label = (mpls_label_t *)wlabel;