diff options
author | David Timber <mieabby@gmail.com> | 2020-09-17 19:00:28 +0930 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-09-17 19:00:28 +0930 |
commit | e6953dcb47193746a4f4d9fff0193723fadbb3e6 (patch) | |
tree | b6fe802c3faf48ec7e294fa61207b4e9126fc3c1 /src/htbt.c | |
parent | b54ace5cd8a873be804529f7b8221ee62600d17d (diff) |
* Change value types of containers to uintptr_t
* htbt: fix leak in `htbt_main_q_hover()`
* proone-recon: fix parse bug
Diffstat (limited to 'src/htbt.c')
-rw-r--r-- | src/htbt.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -159,7 +159,10 @@ static bool htbt_main_q_req_slip (prne_htbt_t *ctx, htbt_req_slip_t *in) { htbt_init_req_slip(ny_slip); prne_dbgtrap(pth_mutex_acquire(&ctx->main.lock, FALSE, NULL)); - alloc = prne_llist_append(&ctx->main.req_q, ny_slip) != NULL; + alloc = + prne_llist_append( + &ctx->main.req_q, + (prne_llist_element_t)ny_slip) != NULL; if (alloc) { prne_dbgtrap(pth_cond_notify(&ctx->main.cond, FALSE)); } @@ -217,7 +220,7 @@ static bool htbt_main_q_hover ( body->parent = ctx; if (trace == NULL) { prne_dbgtrap(pth_mutex_acquire(&ctx->main.lock, FALSE, NULL)); - ny_trace = prne_llist_append(&ctx->main.hover_req, (void*)1); + ny_trace = prne_llist_append(&ctx->main.hover_req, 1); pth_mutex_release(&ctx->main.lock); if (ny_trace == NULL) { goto END; @@ -240,7 +243,7 @@ static bool htbt_main_q_hover ( END: if (ny_trace != NULL) { prne_dbgtrap(pth_mutex_acquire(&ctx->main.lock, FALSE, NULL)); - prne_llist_append(&ctx->main.hover_req, ny_trace); + prne_llist_erase(&ctx->main.hover_req, ny_trace); pth_mutex_release(&ctx->main.lock); } htbt_free_req_slip(&slip); @@ -1620,15 +1623,13 @@ static void htbt_main_slv_hover_f ( htbt_main_client_t *ctx = (htbt_main_client_t*)ioctx; if (ctx->hv_trace != NULL) { - const uintptr_t cur = (uintptr_t)ctx->hv_trace->element; - - if (cur >= HTBT_HOVER_MAX_REDIR) { + if (ctx->hv_trace->element >= HTBT_HOVER_MAX_REDIR) { *status = PRNE_HTBT_STATUS_LIMIT; *err = 0; return; } else { - ctx->hv_trace->element = (void*)(cur + 1); + ctx->hv_trace->element += 1; ctx->hv_used = true; } } @@ -2375,7 +2376,9 @@ static void htbt_lbd_serve_loop (prne_htbt_t *ctx) { goto CATCH; } - ent = prne_llist_append(&ctx->lbd.conn_list, client); + ent = prne_llist_append( + &ctx->lbd.conn_list, + (prne_llist_element_t)client); if (ent == NULL) { goto CATCH; } |