From: Alan T. DeKok Date: Fri, 22 May 2020 13:33:47 +0000 (-0400) Subject: don't extract things which aren't in the heap X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e60e7ae929f2ee92f6407396ecfc03fe2ef5e06a;p=thirdparty%2Ffreeradius-server.git don't extract things which aren't in the heap --- diff --git a/src/lib/util/heap.c b/src/lib/util/heap.c index df8c301fc25..42c554eee22 100644 --- a/src/lib/util/heap.c +++ b/src/lib/util/heap.c @@ -220,6 +220,14 @@ int fr_heap_extract(fr_heap_t *hp, void *data) return -1; } + /* + * Not in the heap. + */ + child = index_get(hp, data); + if ((child < 0) || ((child == 0) && (data == hp->p[0]))) { + return -1; + } + max = hp->num_elements - 1; /*