From 2b82c94acff6b4a90da5af700b59cd398481e968 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sun, 7 Mar 2021 20:47:27 -0600 Subject: [PATCH] if_wg: avoid null ptr deref While we're here, sync up with OpenBSD and don't use a keypair !kp_valid MFC after: 3 days --- sys/dev/if_wg/module/wg_noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/wg_noise.c b/sys/dev/if_wg/module/wg_noise.c index 0fa7664e66d..08a0d8d3287 100644 --- a/sys/dev/if_wg/module/wg_noise.c +++ b/sys/dev/if_wg/module/wg_noise.c @@ -673,7 +673,7 @@ noise_remote_decrypt(struct noise_remote *r, struct noise_data *data, * REKEY_AFTER_TIME_RECV seconds. */ ret = ESTALE; kp = r->r_current; - if (kp->kp_is_initiator && + if (kp != NULL && kp->kp_valid && kp->kp_is_initiator && noise_timer_expired(&kp->kp_birthdate, REKEY_AFTER_TIME_RECV, 0)) goto error;