mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 19:53:46 +00:00
Fix a potential null pointer acceess issue. #1854
It's possible that c-ares calls the callback function immediately in ares_gethostbyname, which may free the server structure in that callback function.
This commit is contained in:
+2
-2
@@ -903,6 +903,8 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
ev_io_start(EV_A_ & remote->send_ctx->io);
|
||||
}
|
||||
} else {
|
||||
ev_io_stop(EV_A_ & server_recv_ctx->io);
|
||||
|
||||
query_t *query = ss_malloc(sizeof(query_t));
|
||||
memset(query, 0, sizeof(query_t));
|
||||
query->server = server;
|
||||
@@ -920,8 +922,6 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
close_and_free_server(EV_A_ server);
|
||||
return;
|
||||
}
|
||||
|
||||
ev_io_stop(EV_A_ & server_recv_ctx->io);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user