wireguard: fix dereferences null pointer
[vpp.git] / src / plugins / wireguard / wireguard_input.c
index ba5a1d6..7db1a0c 100644 (file)
@@ -902,10 +902,17 @@ wg_input_post (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
          last_rec_idx = data->receiver_index;
        }
 
-      ASSERT (peer != NULL); /* this pointer never should be NULL */
-      if (PREDICT_FALSE (wg_input_post_process (vm, b[0], next, peer, data,
-                                               &is_keepalive) < 0))
-       goto trace;
+      if (PREDICT_TRUE (peer != NULL))
+       {
+         if (PREDICT_FALSE (wg_input_post_process (vm, b[0], next, peer, data,
+                                                   &is_keepalive) < 0))
+           goto trace;
+       }
+      else
+       {
+         next[0] = WG_INPUT_NEXT_PUNT;
+         goto trace;
+       }
 
       if (PREDICT_FALSE (peer_idx && (last_peer_time_idx != peer_idx)))
        {