nat: fix coverity 249202 30/37030/1
authorBenoît Ganne <bganne@cisco.com>
Mon, 29 Aug 2022 09:56:08 +0000 (11:56 +0200)
committerBenoît Ganne <bganne@cisco.com>
Mon, 29 Aug 2022 09:56:08 +0000 (11:56 +0200)
In case of a bad packet, the bihash kv is not initialized before being
copied in the trace. Make sure it is initialized to 0.

Type: fix

Change-Id: I22fcfe99f3586d0fa128493059547a56557b8fb5
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/plugins/nat/nat44-ed/nat44_ed_out2in.c

index e53d9c5..3344912 100644 (file)
@@ -759,7 +759,7 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
       ip_protocol_t proto0;
       ip4_header_t *ip0;
       snat_session_t *s0 = 0;
-      clib_bihash_kv_16_8_t kv0, value0;
+      clib_bihash_kv_16_8_t kv0 = {}, value0;
       nat_translation_error_e translation_error = NAT_ED_TRNSL_ERR_SUCCESS;
       nat_slow_path_reason_e slow_path_reason = NAT_ED_SP_REASON_NO_REASON;
       nat_6t_flow_t *f = 0;
@@ -1060,7 +1060,7 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
       udp_header_t *udp0;
       icmp46_header_t *icmp0;
       snat_session_t *s0 = 0;
-      clib_bihash_kv_16_8_t kv0, value0;
+      clib_bihash_kv_16_8_t kv0 = {}, value0;
       lb_nat_type_t lb_nat0;
       twice_nat_type_t twice_nat0;
       u8 identity_nat0;