Browse Source

fix the buffer corruption

pull/51/head
Max Lv 10 years ago
parent
commit
11da9b233a
2 changed files with 4 additions and 2 deletions
  1. 3
      src/jconf.c
  2. 3
      src/udprelay.c

3
src/jconf.c

@ -55,7 +55,8 @@ void parse_addr(const char *str, addr_t *addr)
pch = strchr(pch + 1, ':');
}
if (n > 1) {
if (strcmp(str+ret, "]") != 0) {
if (strcmp(str+ret, "]") != 0)
{
ret = -1;
}
}

3
src/udprelay.c

@ -279,7 +279,7 @@ struct query_ctx *new_query_ctx(asyncns_query_t *query,
ctx->buf_len = buf_len;
memcpy(ctx->buf, buf, buf_len);
ctx->query = query;
ev_timer_init(&ctx->watcher, query_resolve_cb, 0.2, 0.5);
ev_timer_init(&ctx->watcher, query_resolve_cb, 0.1, 0.2);
return ctx;
}
@ -610,6 +610,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents)
memcpy(tmp + addr_header_len, buf, buf_len);
free(buf);
buf = tmp;
buf_len += addr_header_len;
#else
char host[256] = {0};

Loading…
Cancel
Save