diff options
Diffstat (limited to 'src/plugins/wireguard')
-rw-r--r-- | src/plugins/wireguard/wireguard_output_tun.c | 5 | ||||
-rw-r--r-- | src/plugins/wireguard/wireguard_peer.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/wireguard/wireguard_output_tun.c b/src/plugins/wireguard/wireguard_output_tun.c index 14df692eebc..64aaba7947f 100644 --- a/src/plugins/wireguard/wireguard_output_tun.c +++ b/src/plugins/wireguard/wireguard_output_tun.c @@ -371,6 +371,11 @@ wg_output_tun_inline (vlib_main_t *vm, vlib_node_runtime_t *node, if (PREDICT_FALSE (last_adj_index != adj_index)) { peeri = wg_peer_get_by_adj_index (adj_index); + if (peeri == INDEX_INVALID) + { + b[0]->error = node->errors[WG_OUTPUT_ERROR_PEER]; + goto out; + } peer = wg_peer_get (peeri); } diff --git a/src/plugins/wireguard/wireguard_peer.h b/src/plugins/wireguard/wireguard_peer.h index 1af5799bc76..f3d80fbf9fe 100644 --- a/src/plugins/wireguard/wireguard_peer.h +++ b/src/plugins/wireguard/wireguard_peer.h @@ -166,6 +166,8 @@ wg_peer_get (index_t peeri) static inline index_t wg_peer_get_by_adj_index (index_t ai) { + if (ai > vec_len (wg_peer_by_adj_index)) + return INDEX_INVALID; return (wg_peer_by_adj_index[ai]); } |