Comment 0 for bug 1959896

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This was flagged in the MIR[1] review for frr.

There is an incorrect strncmp() usage in the code that was flagged by gcc:

bgpd/bgp_community_alias.c: In function ‘bgp_ca_alias_hash_cmp’:
bgpd/bgp_community_alias.c:60:17: warning: ‘strncmp’ specified bound 8228 exceeds source size 8192 [-Wstringop-overread]
   60 | return (strncmp(ca1->alias, ca2->alias, sizeof(struct community_alias))
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bgpd/bgp_community_alias.c: In function ‘bgp_ca_community_hash_cmp’:
bgpd/bgp_community_alias.c:43:17: warning: ‘strncmp’ specified bound 8228 exceeds source size 36 [-Wstringop-overread]
   43 | return (strncmp(ca1->community, ca2->community,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   44 | sizeof(struct community_alias))
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I filed an upstream bug[2], and it was fixed[3].

1. https://bugs.launchpad.net/ubuntu/+source/frr/+bug/1951834
2. https://github.com/FRRouting/frr/issues/10484
3. https://github.com/FRRouting/frr/pull/10485