Skip to content

Commit

Permalink
Update crypthook.c
Browse files Browse the repository at this point in the history
Fixed recv() hook to include MSG_PEEK while verifying header.
  • Loading branch information
Chokepoint committed Oct 12, 2014
1 parent bceeb0b commit 0728cd1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypthook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit 0728cd1

Please sign in to comment.