wireguard: coverity fix 64/31364/4
authorArtem Glazychev <artem.glazychev@xored.com>
Wed, 17 Feb 2021 06:24:17 +0000 (13:24 +0700)
committerDamjan Marion <dmarion@me.com>
Wed, 24 Feb 2021 14:22:49 +0000 (14:22 +0000)
explicit null dereferenced

Type: fix

Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
Change-Id: Id1e4b0e048dbd0a68063c63374172ab6d3653aff

src/plugins/wireguard/wireguard_input.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 2690cf5..5db8142
 #include <wireguard/wireguard_send.h>
 #include <wireguard/wireguard_if.h>
 
-#define foreach_wg_input_error                          \
-  _(NONE, "No error")                                   \
-  _(HANDSHAKE_MAC, "Invalid MAC handshake")             \
-  _(PEER, "Peer error")                                 \
-  _(INTERFACE, "Interface error")                       \
-  _(DECRYPTION, "Failed during decryption")             \
-  _(KEEPALIVE_SEND, "Failed while sending Keepalive")   \
-  _(HANDSHAKE_SEND, "Failed while sending Handshake")   \
-  _(TOO_BIG, "Packet too big")                          \
-  _(UNDEFINED, "Undefined error")
+#define foreach_wg_input_error                                                \
+  _ (NONE, "No error")                                                        \
+  _ (HANDSHAKE_MAC, "Invalid MAC handshake")                                  \
+  _ (PEER, "Peer error")                                                      \
+  _ (INTERFACE, "Interface error")                                            \
+  _ (DECRYPTION, "Failed during decryption")                                  \
+  _ (KEEPALIVE_SEND, "Failed while sending Keepalive")                        \
+  _ (HANDSHAKE_SEND, "Failed while sending Handshake")                        \
+  _ (HANDSHAKE_RECEIVE, "Failed while receiving Handshake")                   \
+  _ (TOO_BIG, "Packet too big")                                               \
+  _ (UNDEFINED, "Undefined error")
 
 typedef enum
 {
@@ -245,7 +246,7 @@ wg_handshake_process (vlib_main_t * vm, wg_main_t * wmp, vlib_buffer_t * b)
        break;
       }
     default:
-      break;
+      return WG_INPUT_ERROR_HANDSHAKE_RECEIVE;
     }
 
   wg_timers_any_authenticated_packet_received (peer);