From abd0244aba263fd8894a77dd830dda223e70627a Mon Sep 17 00:00:00 2001 From: Christian Huitema Date: Fri, 20 Jan 2017 19:33:12 -0800 Subject: [PATCH] Fixing a potential bug in the RB tree for netreq_by_id --- src/context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/context.c b/src/context.c index 34432780..41a194f7 100644 --- a/src/context.c +++ b/src/context.c @@ -747,7 +747,14 @@ tls_only_is_in_transports_list(getdns_context *context) { static int net_req_query_id_cmp(const void *id1, const void *id2) { - return (intptr_t)id1 - (intptr_t)id2; + int ret = 0; + + if (id1 != id2) + { + ret = ((intptr_t)id1 < (intptr_t)id2) ? -1 : 1; + } + + return ret; } static getdns_tsig_info const tsig_info[] = {