Skip to content

Commit

Permalink
Make sure cert_type is not 0 to prevent leak of certid->id_buf.
Browse files Browse the repository at this point in the history
Found by David Linder
ok patrick@
  • Loading branch information
tobhe committed Sep 4, 2023
1 parent 0dd6a1a commit 4a67fda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion iked/ikev2_pld.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: ikev2_pld.c,v 1.132 2023/08/04 19:06:25 claudio Exp $ */
/* $OpenBSD: ikev2_pld.c,v 1.133 2023/09/02 18:36:30 tobhe Exp $ */

/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
Expand Down Expand Up @@ -796,6 +796,10 @@ ikev2_validate_cert(struct iked_message *msg, size_t offset, size_t left,
return (-1);
}
memcpy(cert, msgbuf + offset, sizeof(*cert));
if (cert->cert_type == IKEV2_CERT_NONE) {
log_debug("%s: malformed payload: invalid cert type", __func__);
return (-1);
}

return (0);
}
Expand Down

0 comments on commit 4a67fda

Please sign in to comment.