Oct. 26, 2022
4:10 a.m.
* zic.c (make_links): Don't call qsort(NULL, 0, ...) as this has undefined behavior in C. This fixes a bug introduced five days ago. --- zic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zic.c b/zic.c index 78afa67..a699285 100644 --- a/zic.c +++ b/zic.c @@ -683,7 +683,8 @@ static void make_links(void) { ptrdiff_t i, j, nalinks; - qsort(links, nlinks, sizeof *links, qsort_linkcmp); + if (nlinks) + qsort(links, nlinks, sizeof *links, qsort_linkcmp); /* Ignore each link superseded by a later link with the same name. */ j = 0; -- 2.37.3