Skip to content

Commit

Permalink
Occupy the rec_version field of a decoded dtls record
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #22238)
  • Loading branch information
fwh-dc authored and paulidale committed Oct 3, 2023
1 parent 6f66602 commit 4b5b223
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ssl/record/methods/dtls_meth.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
size_t more, n;
TLS_RL_RECORD *rr;
unsigned char *p = NULL;
unsigned short version;
DTLS_BITMAP *bitmap;
unsigned int is_next_epoch;

Expand Down Expand Up @@ -438,7 +437,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
rr->type = *(p++);
ssl_major = *(p++);
ssl_minor = *(p++);
version = (ssl_major << 8) | ssl_minor;
rr->rec_version = (ssl_major << 8) | ssl_minor;

/* sequence number is 64 bits, with top 2 bytes = epoch */
n2s(p, rr->epoch);
Expand All @@ -453,7 +452,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
* version number (e.g. because of protocol version errors)
*/
if (!rl->is_first_record && rr->type != SSL3_RT_ALERT) {
if (version != rl->version) {
if (rr->rec_version != rl->version) {
/* unexpected version, silently discard */
rr->length = 0;
rl->packet_length = 0;
Expand Down

0 comments on commit 4b5b223

Please sign in to comment.