[quagga-dev 14868] [PATCH 2/3] bgpd: Fix code path that leads to uninitialized variables

Donald Sharp sharpd at cumulusnetworks.com
Fri Mar 11 01:16:47 GMT 2016


subtype and sublength are not initialized and if on Line 1877
BGP_ATTR_ENCAP != type we will not set subtype and sublength,
but these variables are used immediately below that if statement.

This issue was discovered via the freebsd compiler.

Signed-off-by: Donald Sharp <sharpd at cumulusnetworks.com>
---
 bgpd/bgp_attr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index f34e649..149b888 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1870,8 +1870,8 @@ bgp_attr_encap(
   }
 
   while (length >= 4) {
-    uint16_t	subtype;
-    uint16_t	sublength;
+    uint16_t	subtype = 0;
+    uint16_t	sublength = 0;
     struct bgp_attr_encap_subtlv *tlv;
 
     if (BGP_ATTR_ENCAP == type) {
-- 
1.9.1





More information about the Quagga-dev mailing list