From 71dcb2753d8dc428f0f4c731474fd1cad5fc459a Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 13 Jun 2016 10:36:43 +0900 Subject: [PATCH] Fix bug about receiving packets in case of 0 size payload Change-Id: I6b69d8c81a8eaaf137b072bc2c6b8804523eb173 Signed-off-by: Junghoon Park --- src/aul_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aul_sock.c b/src/aul_sock.c index 91a87a0..390bd70 100644 --- a/src/aul_sock.c +++ b/src/aul_sock.c @@ -430,7 +430,7 @@ API app_pkt_t *aul_sock_recv_pkt(int fd, int *clifd, struct ucred *cr) memcpy(&datalen, buf + sizeof(int), sizeof(int)); memcpy(&opt, buf + sizeof(int) + sizeof(int), sizeof(int)); - if (datalen <= 0 || datalen > MAX_PAYLOAD_SIZE) { + if (datalen < 0 || datalen > MAX_PAYLOAD_SIZE) { close(*clifd); return NULL; } @@ -493,7 +493,7 @@ retry_recv: memcpy(&len, buf + sizeof(int), sizeof(int)); memcpy(&recv_opt, buf + sizeof(int) + sizeof(int), sizeof(int)); - if (len <= 0 || len > MAX_PAYLOAD_SIZE) { + if (len < 0 || len > MAX_PAYLOAD_SIZE) { close(fd); *ret_pkt = NULL; return -ECOMM; -- 2.7.4