mirror of
https://github.com/mirror/wget.git
synced 2025-03-25 01:00:13 +08:00
Bugfix: Prevent sorting when there are less than two elements
* src/utils.c (stable_sort): Add condition nmemb > 1, sort only when there is more than one element Prevent SIGSEGV.
This commit is contained in:
parent
628fb565c7
commit
acb1d1a668
@ -2428,7 +2428,7 @@ void
|
||||
stable_sort (void *base, size_t nmemb, size_t size,
|
||||
int (*cmpfun) (const void *, const void *))
|
||||
{
|
||||
if (size > 1)
|
||||
if (nmemb > 1 && size > 1)
|
||||
{
|
||||
void *temp = xmalloc (nmemb * size);
|
||||
mergesort_internal (base, temp, size, 0, nmemb - 1, cmpfun);
|
||||
|
Loading…
Reference in New Issue
Block a user