Resolve strncmp warnings
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
frr (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Won't Fix
|
Undecided
|
Unassigned | ||
Lunar |
Fix Released
|
Undecided
|
Unassigned | ||
Mantic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* Users of frr reported warnings while building frr 8.1 with -Wstringop-
* This crash is caused because the size parameter should be the size of the specific struct member that is being compared, alias and community, and not the whole struct. The fix is to get rid of sizeof(struct community_alias) in bgp_ca_
[Test Plan]
$ lxc launch ubuntu:22.04 jammy-frr
$ lxc shell jammy-frr
1. Install frr:
# apt install frr
2. Download frr 8.1 and unzip it.
3. Enter frr 8.1 after unzipping it.
4. Install dependencies:
# apt install -y autoconf automake libtool make gawk libreadline-dev texinfo pkg-config libpam0g-dev libjson-c-dev bison flex python3-pytest protobuf-c-compiler libprotobuf-c-dev libelf-dev pkg-config bison flex libc-ares-dev python3-dev python3-sphinx install-info build-essential libsnmp-dev perl libcap-dev python2 libunwind-dev libyang2 libyang2-dev
5. Add FRR user and groups:
# groupadd -r -g 92 frr
# groupadd -r -g 85 frrvty
# adduser --system --ingroup frr --home /var/run/frr/ --gecos "FRR suite" --shell /sbin/nologin frr
# usermod -a -G frrvty frr
6. #./bootstrap.sh
7. #./configure
8. # make -Wstringop-overread
Example of failed output:
CC bgpd/bgp_
bgpd/bgp_
bgpd/bgp_
60 | return (strncmp(
| ^~~~~~~
bgpd/bgp_
bgpd/bgp_
43 | return (strncmp(
| ^~~~~~~
44 | sizeof(struct community_alias))
| ~~~~~~~
Example of successful output:
No warnings for strncmp usage during building frr 8.1.
[Where problems could occur]
* The patch itself modifies only the bgp_community_
-------
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_
bgpd/bgp_
60 | return (strncmp(
| ^~~~~~~
bgpd/bgp_
bgpd/bgp_
43 | return (strncmp(
| ^~~~~~~
44 | sizeof(struct community_alias))
| ~~~~~~~
I filed an upstream bug[2], and it was fixed[3].
1. https:/
2. https:/
3. https:/
Related branches
- Steve Langasek: Pending requested
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 71 lines (+49/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/resolve-strncmp-warnings.patch (+40/-0)
debian/patches/series (+1/-0)
Changed in frr (Ubuntu): | |
status: | In Progress → New |
assignee: | Andreas Hasenack (ahasenack) → nobody |
Changed in frr (Ubuntu Lunar): | |
status: | New → Fix Released |
Changed in frr (Ubuntu Mantic): | |
status: | New → Fix Released |
tags: | added: server-todo |
description: | updated |
description: | updated |
tags: | removed: server-todo |
Changed in frr (Ubuntu Jammy): | |
status: | Incomplete → Won't Fix |
assignee: | Michał Małoszewski (michal-maloszewski99) → nobody |
Fix was merged on dev/8.2 un upstream [1].
Mantic and Lunar are in 8.4, so the fix is there (and the build logs are clean too).
[1] https:/ /github. com/FRRouting/ frr/pull/ 10485