Browse Source

fix a buffer corruption

pull/4/merge
Max Lv 11 years ago
parent
commit
5b32a774c5
1 changed files with 2 additions and 2 deletions
  1. 4
      src/server.c

4
src/server.c

@ -259,7 +259,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) {
return;
}
// XXX: should handel buffer carefully
// XXX: should handle buffer carefully
if (r > offset) {
server->buf_len = r - offset;
server->buf_idx = offset;
@ -401,7 +401,7 @@ static void server_resolve_cb(EV_P_ ev_timer *watcher, int revents) {
// XXX: should handel buffer carefully
if (server->buf_len > 0) {
memcpy(remote->buf, server->buf, server->buf_len);
memcpy(remote->buf, server->buf + server->buf_idx, server->buf_len);
remote->buf_len = server->buf_len;
remote->buf_idx = 0;
server->buf_len = 0;

Loading…
Cancel
Save