Browse Source

fix socks5 response header

pull/35/head
Max Lv 11 years ago
parent
commit
7658d1e585
1 changed files with 9 additions and 2 deletions
  1. 11
      src/udprelay.c

11
src/udprelay.c

@ -478,11 +478,18 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents)
// error in parse header // error in parse header
goto CLEAN_UP; goto CLEAN_UP;
} }
buf_len -= addr_header_len;
memmove(buf, buf + addr_header_len, buf_len);
// Construct packet
char *tmpbuf = malloc(buf_len + 3);
memset(tmpbuf, 0, 3);
memcpy(tmpbuf + 3, buf, buf_len);
free(buf);
buf = tmpbuf;
buf_len += 3;
#endif #endif
#ifdef UDPRELAY_REMOTE #ifdef UDPRELAY_REMOTE
// Construct packet
char *tmpbuf = malloc(buf_len + addr_header_len); char *tmpbuf = malloc(buf_len + addr_header_len);
memcpy(tmpbuf, remote_ctx->addr_header, addr_header_len); memcpy(tmpbuf, remote_ctx->addr_header, addr_header_len);
memcpy(tmpbuf + addr_header_len, buf, buf_len); memcpy(tmpbuf + addr_header_len, buf, buf_len);

Loading…
Cancel
Save