diff options
author | Adam Langley <agl@imperialviolet.org> | 2014-06-06 14:44:20 -0700 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-08-06 20:41:23 +0100 |
commit | aad61c0a57a3b6371496034db61675abcdb81811 (patch) | |
tree | 7a93f9e035fa080944047e72dd49ab36f8a58217 /ssl/d1_both.c | |
parent | 8ca4c4b25e050b881f3aad7017052842b888722d (diff) |
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>
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 4d8d2d15ba..29df26e99a 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -776,7 +776,9 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok) /* read the body of the fragment (header has already been read */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment,frag_len,0); - if (i<=0 || (unsigned long)i!=frag_len) + if ((unsigned long)i!=frag_len) + i = -1; + if (i<=0) goto err; } |