Don't crash on socks5
This commit is contained in:
parent
6216935084
commit
429e66cbc8
2 changed files with 4 additions and 6 deletions
|
@ -38,10 +38,11 @@ struct buffer_packet* get_read_buffer(struct algo_ctx *app_ctx, struct evt_core_
|
||||||
int waiting_count = 0;
|
int waiting_count = 0;
|
||||||
g_hash_table_foreach(app_ctx->write_waiting, (GHFunc)iterate, &waiting_count);
|
g_hash_table_foreach(app_ctx->write_waiting, (GHFunc)iterate, &waiting_count);
|
||||||
g_hash_table_foreach(app_ctx->used_buffer, (GHFunc)iterate2, NULL);
|
g_hash_table_foreach(app_ctx->used_buffer, (GHFunc)iterate2, NULL);
|
||||||
fprintf(stderr, "total_buffers=%d, used_buffers=%d. free_buffer=%d, waiting_buffer=%d.\n",
|
fprintf(stderr, "total_buffers=%d, free_buffer=%d, used_buffers=%d, app_buffer=%d, write_buffer=%d.\n",
|
||||||
PACKET_BUFFER_SIZE,
|
PACKET_BUFFER_SIZE,
|
||||||
g_hash_table_size(app_ctx->used_buffer),
|
|
||||||
app_ctx->free_buffer->length,
|
app_ctx->free_buffer->length,
|
||||||
|
g_hash_table_size(app_ctx->used_buffer),
|
||||||
|
g_hash_table_size(app_ctx->application_waiting),
|
||||||
waiting_count);
|
waiting_count);
|
||||||
// 2.1 If no buffer is available, we subscribe to be notified later
|
// 2.1 If no buffer is available, we subscribe to be notified later
|
||||||
g_queue_push_tail (app_ctx->read_waiting, &(fdinfo->fd));
|
g_queue_push_tail (app_ctx->read_waiting, &(fdinfo->fd));
|
||||||
|
|
|
@ -42,10 +42,7 @@ int socks5_reply(int sock) {
|
||||||
int res;
|
int res;
|
||||||
struct server_reply sr = {0};
|
struct server_reply sr = {0};
|
||||||
res = read_entity(sock, &sr, sizeof(uint8_t) * 4);
|
res = read_entity(sock, &sr, sizeof(uint8_t) * 4);
|
||||||
if (res == -1) {
|
if (res == -1) goto read_error;
|
||||||
perror("read_entity");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(sr.atyp) {
|
switch(sr.atyp) {
|
||||||
case ATYP_IPV4:
|
case ATYP_IPV4:
|
||||||
|
|
Loading…
Reference in a new issue