EAP-pwd server: Fix Total-Length parsing for fragment reassembly
authorJouni Malinen <j@w1.fi>
Sat, 2 May 2015 16:26:06 +0000 (19:26 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2015 15:26:50 +0000 (18:26 +0300)
commit3035cc2894e08319b905bd6561e8bddc8c2db9fa
tree5cfef06932df59feecda1450cce92a112b6688f3
parent477c74395acd0123340457ba6f15ab345d42016e
EAP-pwd server: 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_server/eap_server_pwd.c