From 713cfb3d145f9db242138405f16d4ab225e8ba04 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 13 Jun 2010 18:48:27 +0200 Subject: Abort processing for some client errors (instead of crashing) Missing 'return' statements caused the code to keep running on a deallocated client, which would cause the server to crash. --- daemon/client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/client.c b/daemon/client.c index 80bc0c7..ac1045a 100644 --- a/daemon/client.c +++ b/daemon/client.c @@ -520,14 +520,17 @@ static void process_recv(struct mux_client *client) usbmuxd_log(LL_INFO, "Client %d version mismatch: expected %d, got %d", client->fd, USBMUXD_PROTOCOL_VERSION, hdr->version); #endif client_close(client); + return; } if(hdr->length > client->ib_capacity) { usbmuxd_log(LL_INFO, "Client %d message is too long (%d bytes)", client->fd, hdr->length); client_close(client); + return; } if(hdr->length < sizeof(struct usbmuxd_header)) { usbmuxd_log(LL_ERROR, "Client %d message is too short (%d bytes)", client->fd, hdr->length); client_close(client); + return; } if(client->ib_size < hdr->length) { if(did_read) -- cgit v1.1-32-gdbae