diff --git a/src/server.c b/src/server.c index 9d482368..093459c3 100644 --- a/src/server.c +++ b/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;