EAP-pwd peer: Fix Total-Length parsing for fragment reassembly
authorJouni Malinen <j@w1.fi>
Sat, 2 May 2015 16:23:04 +0000 (19:23 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2015 15:26:50 +0000 (18:26 +0300)
commit477c74395acd0123340457ba6f15ab345d42016e
tree83447876ddb63bb02cdf40a5454acd63ab93f93d
parente28a58be26184c2a23f80b410e0997ef1bd5d578
EAP-pwd peer: Fix Total-Length parsing for fragment reassembly

The remaining number of bytes in the message could be smaller than the
Total-Length field size, so the length needs to be explicitly checked
prior to reading the field and decrementing the len variable. This could
have resulted in the remaining length becoming negative and interpreted
as a huge positive integer.

In addition, check that there is no already started fragment in progress
before allocating a new buffer for reassembling fragments. This avoid a
potential memory leak when processing invalid message.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/eap_peer/eap_pwd.c