]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dnssec: don't qsort() empty hashlist
authorOndřej Surý <ondrej@sury.org>
Sun, 13 Oct 2019 04:53:06 +0000 (06:53 +0200)
committerOndřej Surý <ondrej@sury.org>
Mon, 4 Nov 2019 15:15:22 +0000 (16:15 +0100)
bin/dnssec/dnssec-signzone.c

index 8f3e74cb2c8a27ab709733491e5250696a23b9b2..47b7c257c07ed2d969c94ebb1dc74ba7dd3bb443 100644 (file)
@@ -787,7 +787,10 @@ hashlist_comp(const void *a, const void *b) {
 
 static void
 hashlist_sort(hashlist_t *l) {
-       qsort(l->hashbuf, l->entries, l->length, hashlist_comp);
+       INSIST(l->hashbuf != NULL || l->length == 0);
+       if (l->length > 0) {
+               qsort(l->hashbuf, l->entries, l->length, hashlist_comp);
+       }
 }
 
 static bool