From 0728cd191f0638f52f8d6af8a9482a4996322ffc Mon Sep 17 00:00:00 2001 From: Chokepoint Date: Sun, 12 Oct 2014 11:23:10 -0400 Subject: [PATCH] Update crypthook.c Fixed recv() hook to include MSG_PEEK while verifying header. --- crypthook.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypthook.c b/crypthook.c index 4224a2a..728f001 100644 --- a/crypthook.c +++ b/crypthook.c @@ -163,7 +163,7 @@ static int decrypt_data(char *in, int len, char *out) { /* Hook recv and decrypt the data before returning to the program */ ssize_t recv(int sockfd, void *buf, size_t len, int flags) { char outbuf[MAX_LEN]; - char temp[MAX_LEN]; + unsigned char temp[MAX_LEN]; int outlen, ret, packet_len; @@ -177,7 +177,7 @@ ssize_t recv(int sockfd, void *buf, size_t len, int flags) { return old_recv(sockfd, buf, len, flags); //ret = old_recv(sockfd, (void *)temp, MAX_LEN, flags); - ret = old_recv(sockfd, (void *)temp, 3, flags); + ret = old_recv(sockfd, (void *)temp, 3, MSG_PEEK); if (ret < 1) { // Nothing to decrypt return ret;