Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 1bc232f74222cda17c0e31ec77b155530290abb6 Author: Sven Eckelmann sven@open-mesh.com Date: Fri Jan 4 09:59:03 2013 +0100
alfred: Break out of set_data loop when buffer is full
The current limit for data the client program can supply is 9000 bytes. But client programs providing more than 9000 bytes before they close their socket would create an endless loop and therefore block the complete daemon program.
Signed-off-by: Sven Eckelmann sven@open-mesh.com
1bc232f74222cda17c0e31ec77b155530290abb6 client.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/client.c b/client.c index 527d78d..31929a7 100644 --- a/client.c +++ b/client.c @@ -114,6 +114,9 @@ int alfred_client_set_data(struct globals *globals) while (!feof(stdin)) { ret = fread(&buf[len], 1, sizeof(buf) - len, stdin); len += ret; + + if (sizeof(buf) == len) + break; }
packet->type = ALFRED_PUSH_DATA;