summaryrefslogtreecommitdiffstats
path: root/daemon/client.c
diff options
context:
space:
mode:
authorGravatar Hector Martin2010-01-23 23:09:43 +0100
committerGravatar Hector Martin2010-01-24 00:20:01 +0100
commitc0b02222fd85feabb0b9901364082dc6ab484b68 (patch)
treee465e0a29a24431c67feb35529912214f8d1308f /daemon/client.c
parent68729a347011a8fb39f1e4aa35ae06c4f2f491d4 (diff)
downloadusbmuxd-c0b02222fd85feabb0b9901364082dc6ab484b68.tar.gz
usbmuxd-c0b02222fd85feabb0b9901364082dc6ab484b68.tar.bz2
Clean up packet size types and add some paranoia
None of this should fix an exploit, it's just healthy paranoia.
Diffstat (limited to 'daemon/client.c')
-rw-r--r--daemon/client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/daemon/client.c b/daemon/client.c
index 5498586..4f44bcc 100644
--- a/daemon/client.c
+++ b/daemon/client.c
@@ -52,11 +52,11 @@ enum client_state {
struct mux_client {
int fd;
unsigned char *ob_buf;
- int ob_size;
- int ob_capacity;
+ uint32_t ob_size;
+ uint32_t ob_capacity;
unsigned char *ib_buf;
- int ib_size;
- int ib_capacity;
+ uint32_t ib_size;
+ uint32_t ib_capacity;
short events, devents;
uint32_t connect_tag;
int connect_device;
@@ -65,7 +65,7 @@ struct mux_client {
static struct collection client_list;
-int client_read(struct mux_client *client, void *buffer, int len)
+int client_read(struct mux_client *client, void *buffer, uint32_t len)
{
usbmuxd_log(LL_SPEW, "client_read fd %d buf %p len %d", client->fd, buffer, len);
if(client->state != CLIENT_CONNECTED) {
@@ -75,7 +75,7 @@ int client_read(struct mux_client *client, void *buffer, int len)
return recv(client->fd, buffer, len, 0);
}
-int client_write(struct mux_client *client, void *buffer, int len)
+int client_write(struct mux_client *client, void *buffer, uint32_t len)
{
usbmuxd_log(LL_SPEW, "client_write fd %d buf %p len %d", client->fd, buffer, len);
if(client->state != CLIENT_CONNECTED) {