]> 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>
Tue, 5 Nov 2019 08:48:51 +0000 (09:48 +0100)
(cherry picked from commit 6bbb0b8e42cd7b2d6ffd9de8517f1a85e60c8019)

bin/dnssec/dnssec-signzone.c

index 88b910227da8bb8975291db8b774494bf75ca5d0..cce743913d98c95c85636efd9701c956b2beaf70 100644 (file)
@@ -794,7 +794,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