fix the buffer corruption

This commit is contained in:
Max Lv
2014-02-22 14:00:43 +08:00
parent 7063d1fa6f
commit 11da9b233a
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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;
}
}
+2 -1
View File
@@ -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};