mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
smb: Don't call qsort with a NULL pointer.
Corresponds to FSP commit 97edc3a2ccdfe1a56edbdf3b387e09d8f02263e8.
This commit is contained in:
parent
6ae6c0b438
commit
3b634ffee6
@ -238,7 +238,10 @@ sort_and_display_entries(int dir, const unsigned char dircolor[])
|
||||
table[size] = new_entry;
|
||||
size++;
|
||||
}
|
||||
qsort(table, size, sizeof(*table), compare);
|
||||
/* If size==0, then table==NULL. According to ISO/IEC 9899:1999
|
||||
* 7.20.5p1, the NULL must not be given to qsort. */
|
||||
if (size > 0)
|
||||
qsort(table, size, sizeof(*table), compare);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
display_entry(table[i], dircolor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user