New Defects reported by Coverity Scan for freerangerouting/frr

scan-admin at coverity.com scan-admin at coverity.com
Wed Oct 12 21:19:09 UTC 2022


Hi,

Please find the latest report on new defect(s) introduced to freerangerouting/frr found with Coverity Scan.

1 new defect(s) introduced to freerangerouting/frr found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1526337:    (SIZEOF_MISMATCH)
/ospfd/ospf_spf.c: 1845 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1837 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1847 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1849 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1843 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1835 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1841 in ospf_spf_calculation_reason2str()
/ospfd/ospf_spf.c: 1839 in ospf_spf_calculation_reason2str()


________________________________________________________________________________________________________
*** CID 1526337:    (SIZEOF_MISMATCH)
/ospfd/ospf_spf.c: 1845 in ospf_spf_calculation_reason2str()
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1845     			strlcat(rbuf, "ASBR, ", sizeof(rbuf));
1846     		if (spf_reason_flags & (1 << SPF_FLAG_MAXAGE))
1847     			strlcat(rbuf, "M, ", sizeof(rbuf));
1848     		if (spf_reason_flags & (1 << SPF_FLAG_ORR_ROOT_CHANGE))
1849     			strlcat(rbuf, "ORR, ", sizeof(rbuf));
1850     
/ospfd/ospf_spf.c: 1837 in ospf_spf_calculation_reason2str()
1831     {
1832     	rbuf[0] = '\0';
1833     	if (spf_reason_flags) {
1834     		if (spf_reason_flags & (1 << SPF_FLAG_ROUTER_LSA_INSTALL))
1835     			strlcat(rbuf, "R, ", sizeof(rbuf));
1836     		if (spf_reason_flags & (1 << SPF_FLAG_NETWORK_LSA_INSTALL))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1837     			strlcat(rbuf, "N, ", sizeof(rbuf));
1838     		if (spf_reason_flags & (1 << SPF_FLAG_SUMMARY_LSA_INSTALL))
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
/ospfd/ospf_spf.c: 1847 in ospf_spf_calculation_reason2str()
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))
1845     			strlcat(rbuf, "ASBR, ", sizeof(rbuf));
1846     		if (spf_reason_flags & (1 << SPF_FLAG_MAXAGE))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1847     			strlcat(rbuf, "M, ", sizeof(rbuf));
1848     		if (spf_reason_flags & (1 << SPF_FLAG_ORR_ROOT_CHANGE))
1849     			strlcat(rbuf, "ORR, ", sizeof(rbuf));
1850     
1851     		size_t rbuflen = strlen(rbuf);
1852     		if (rbuflen >= 2)
/ospfd/ospf_spf.c: 1849 in ospf_spf_calculation_reason2str()
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))
1845     			strlcat(rbuf, "ASBR, ", sizeof(rbuf));
1846     		if (spf_reason_flags & (1 << SPF_FLAG_MAXAGE))
1847     			strlcat(rbuf, "M, ", sizeof(rbuf));
1848     		if (spf_reason_flags & (1 << SPF_FLAG_ORR_ROOT_CHANGE))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1849     			strlcat(rbuf, "ORR, ", sizeof(rbuf));
1850     
1851     		size_t rbuflen = strlen(rbuf);
1852     		if (rbuflen >= 2)
1853     			rbuf[rbuflen - 2] = '\0'; /* skip the last ", " */
1854     		else
/ospfd/ospf_spf.c: 1843 in ospf_spf_calculation_reason2str()
1837     			strlcat(rbuf, "N, ", sizeof(rbuf));
1838     		if (spf_reason_flags & (1 << SPF_FLAG_SUMMARY_LSA_INSTALL))
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))
1845     			strlcat(rbuf, "ASBR, ", sizeof(rbuf));
1846     		if (spf_reason_flags & (1 << SPF_FLAG_MAXAGE))
1847     			strlcat(rbuf, "M, ", sizeof(rbuf));
1848     		if (spf_reason_flags & (1 << SPF_FLAG_ORR_ROOT_CHANGE))
/ospfd/ospf_spf.c: 1835 in ospf_spf_calculation_reason2str()
1829     /* Print Reason for SPF calculation */
1830     static void ospf_spf_calculation_reason2str(char *rbuf)
1831     {
1832     	rbuf[0] = '\0';
1833     	if (spf_reason_flags) {
1834     		if (spf_reason_flags & (1 << SPF_FLAG_ROUTER_LSA_INSTALL))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1835     			strlcat(rbuf, "R, ", sizeof(rbuf));
1836     		if (spf_reason_flags & (1 << SPF_FLAG_NETWORK_LSA_INSTALL))
1837     			strlcat(rbuf, "N, ", sizeof(rbuf));
1838     		if (spf_reason_flags & (1 << SPF_FLAG_SUMMARY_LSA_INSTALL))
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
/ospfd/ospf_spf.c: 1841 in ospf_spf_calculation_reason2str()
1835     			strlcat(rbuf, "R, ", sizeof(rbuf));
1836     		if (spf_reason_flags & (1 << SPF_FLAG_NETWORK_LSA_INSTALL))
1837     			strlcat(rbuf, "N, ", sizeof(rbuf));
1838     		if (spf_reason_flags & (1 << SPF_FLAG_SUMMARY_LSA_INSTALL))
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))
1845     			strlcat(rbuf, "ASBR, ", sizeof(rbuf));
1846     		if (spf_reason_flags & (1 << SPF_FLAG_MAXAGE))
/ospfd/ospf_spf.c: 1839 in ospf_spf_calculation_reason2str()
1833     	if (spf_reason_flags) {
1834     		if (spf_reason_flags & (1 << SPF_FLAG_ROUTER_LSA_INSTALL))
1835     			strlcat(rbuf, "R, ", sizeof(rbuf));
1836     		if (spf_reason_flags & (1 << SPF_FLAG_NETWORK_LSA_INSTALL))
1837     			strlcat(rbuf, "N, ", sizeof(rbuf));
1838     		if (spf_reason_flags & (1 << SPF_FLAG_SUMMARY_LSA_INSTALL))
>>>     CID 1526337:    (SIZEOF_MISMATCH)
>>>     Passing argument "rbuf" of type "char *" and argument "8UL /* sizeof (rbuf) */" to function "strlcat" is suspicious.
1839     			strlcat(rbuf, "S, ", sizeof(rbuf));
1840     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL))
1841     			strlcat(rbuf, "AS, ", sizeof(rbuf));
1842     		if (spf_reason_flags & (1 << SPF_FLAG_ABR_STATUS_CHANGE))
1843     			strlcat(rbuf, "ABR, ", sizeof(rbuf));
1844     		if (spf_reason_flags & (1 << SPF_FLAG_ASBR_STATUS_CHANGE))


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yrtN2DGUU98GYhjd55wXsXtw53zRK70R0agdV-2Fb7c45-2BkxBoZjryQtr5SpUD80NNfE-3DxEmW_O0IDF7c8sUs2B6kWTeWwAJZqriD5fgsfL8PAN30oQTyDbN-2BIUrkWE2KqS8MoNvsfUSpH10ISvsX5wbaCfGfG0M-2FrV6YhBluzyCHpDbdOEUhsWJQpsAnrGiSvl3FoXztlUHChFbS0-2BcY-2FyKCDDiEabq4qvcyqLSsNhEJ6FbvS4Q5ZWUO-2Bw6likwTq3IJz3pcO6PJPJRatWa5ljxP4vurY4A-3D-3D




More information about the dev mailing list