Skip to content

Commit

Permalink
Added more bounds checking when saving a DTLS message fragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejohnstown committed Aug 14, 2014
1 parent 9d4fb79 commit 7e6b3a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/internal.c
Expand Up @@ -2267,7 +2267,9 @@ void DtlsMsgListDelete(DtlsMsg* head, void* heap)
void DtlsMsgSet(DtlsMsg* msg, word32 seq, const byte* data, byte type,
word32 fragOffset, word32 fragSz)
{
if (msg != NULL && data != NULL && msg->fragSz <= msg->sz) {
if (msg != NULL && data != NULL && msg->fragSz <= msg->sz &&
fragOffset < msg->sz && (fragOffset + fragSz) <= msg->sz) {

msg->seq = seq;
msg->type = type;
msg->fragSz += fragSz;
Expand Down

0 comments on commit 7e6b3a8

Please sign in to comment.