]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't extract things which aren't in the heap
authorAlan T. DeKok <aland@freeradius.org>
Fri, 22 May 2020 13:33:47 +0000 (09:33 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 22 May 2020 13:33:47 +0000 (09:33 -0400)
src/lib/util/heap.c

index df8c301fc25f5d32bb9c1f5c5f44542faf5e4b2e..42c554eee22711bc8bfa5102950e859308deb6b4 100644 (file)
@@ -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;
 
        /*