From 38866cb5c444d99596f487e459e1cf2ed26ec0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Sun, 13 Oct 2019 06:53:06 +0200 Subject: [PATCH] dnssec: don't qsort() empty hashlist (cherry picked from commit 6bbb0b8e42cd7b2d6ffd9de8517f1a85e60c8019) --- bin/dnssec/dnssec-signzone.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 88b910227d..cce743913d 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -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