diff options
author | miod <> | 2014-05-18 16:13:48 +0000 |
---|---|---|
committer | miod <> | 2014-05-18 16:13:48 +0000 |
commit | 43c6337e7ac91091d8735e4fae024d0b71db52eb (patch) | |
tree | 652bb651c4059bbc2b88155df142cd7f83e384ab /src/lib/libssl/d1_both.c | |
parent | 07cfa1a278f7bbdc024101f7601144c23cca9b80 (diff) | |
download | openbsd-43c6337e7ac91091d8735e4fae024d0b71db52eb.tar.gz openbsd-43c6337e7ac91091d8735e4fae024d0b71db52eb.tar.bz2 openbsd-43c6337e7ac91091d8735e4fae024d0b71db52eb.zip |
In dtls1_reassemble_fragment() and dtls1_process_out_of_seq_message(), in case
of error, make sure we do not free pitem which is still linked into the
pqueue.
In the same vain, only free `frag' if we allocated it in this function.
Help and ok beck@
Diffstat (limited to 'src/lib/libssl/d1_both.c')
-rw-r--r-- | src/lib/libssl/d1_both.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c index db57bf9d3d..10b62cd410 100644 --- a/src/lib/libssl/d1_both.c +++ b/src/lib/libssl/d1_both.c | |||
@@ -618,7 +618,7 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) | |||
618 | frag->msg_header.frag_len = frag->msg_header.msg_len; | 618 | frag->msg_header.frag_len = frag->msg_header.msg_len; |
619 | frag->msg_header.frag_off = 0; | 619 | frag->msg_header.frag_off = 0; |
620 | } else | 620 | } else |
621 | frag = (hm_fragment*) item->data; | 621 | frag = (hm_fragment*)item->data; |
622 | 622 | ||
623 | /* If message is already reassembled, this must be a | 623 | /* If message is already reassembled, this must be a |
624 | * retransmit and can be dropped. | 624 | * retransmit and can be dropped. |
@@ -671,10 +671,8 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) | |||
671 | return DTLS1_HM_FRAGMENT_RETRY; | 671 | return DTLS1_HM_FRAGMENT_RETRY; |
672 | 672 | ||
673 | err: | 673 | err: |
674 | if (frag != NULL) | 674 | if (item == NULL && frag != NULL) |
675 | dtls1_hm_fragment_free(frag); | 675 | dtls1_hm_fragment_free(frag); |
676 | if (item != NULL) | ||
677 | free(item); | ||
678 | *ok = 0; | 676 | *ok = 0; |
679 | return i; | 677 | return i; |
680 | } | 678 | } |
@@ -755,10 +753,8 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok) | |||
755 | return DTLS1_HM_FRAGMENT_RETRY; | 753 | return DTLS1_HM_FRAGMENT_RETRY; |
756 | 754 | ||
757 | err: | 755 | err: |
758 | if (frag != NULL) | 756 | if (item == NULL && frag != NULL) |
759 | dtls1_hm_fragment_free(frag); | 757 | dtls1_hm_fragment_free(frag); |
760 | if (item != NULL) | ||
761 | free(item); | ||
762 | *ok = 0; | 758 | *ok = 0; |
763 | return i; | 759 | return i; |
764 | } | 760 | } |