Skip to content

Commit 099ccdb

Browse files
aglmattcaswell
authored andcommitted
Fix return code for truncated DTLS fragment.
Previously, a truncated DTLS fragment in |dtls1_process_out_of_seq_message| would cause *ok to be cleared, but the return value would still be the number of bytes read. This would cause |dtls1_get_message| not to consider it an error and it would continue processing as normal until the calling function noticed that *ok was zero. I can't see an exploit here because |dtls1_get_message| uses |s->init_num| as the length, which will always be zero from what I can see. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
1 parent 9871417 commit 099ccdb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ssl/d1_both.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,9 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
771771
/* read the body of the fragment (header has already been read */
772772
i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
773773
frag->fragment,frag_len,0);
774-
if (i<=0 || (unsigned long)i!=frag_len)
774+
if ((unsigned long)i!=frag_len)
775+
i = -1;
776+
if (i<=0)
775777
goto err;
776778
}
777779

0 commit comments

Comments
 (0)