Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 2e68df24cfd0e5c290efc22637ce5f81ea2dec3e Author: Sven Eckelmann sven@narfation.org Date: Sun May 31 13:36:00 2015 +0200
alfred: Drop small push_data packets early
The push_data packets which are too small can be dropped earlier in the transaction process. These cannot be parsed later when finishing the transaction and thus it is unnecessary to first enqueue them to the transaction list and allocate extra memory for the management structure.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
2e68df24cfd0e5c290efc22637ce5f81ea2dec3e recv.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/recv.c b/recv.c index 16242bc..f459190 100644 --- a/recv.c +++ b/recv.c @@ -188,6 +188,8 @@ static int process_alfred_push_data(struct globals *globals, goto err;
len = ntohs(push->header.length); + if (len < (int)(sizeof(*push) - sizeof(push->header))) + goto err;
search.server_addr = mac; search.id = ntohs(push->tx.id);