Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 30f63a5c authored by Rob Swindell's avatar Rob Swindell 💬

NULL pointer checks in strListSort*() and strListDup()

parent f615b604
...@@ -483,22 +483,26 @@ static int QSORT_CALLBACK_TYPE strListCompareAlphaCaseReverse(const void *arg1, ...@@ -483,22 +483,26 @@ static int QSORT_CALLBACK_TYPE strListCompareAlphaCaseReverse(const void *arg1,
void strListSortAlpha(str_list_t list) void strListSortAlpha(str_list_t list)
{ {
qsort(list,strListCount(list),sizeof(char*),strListCompareAlpha); if(list != NULL)
qsort(list,strListCount(list),sizeof(char*),strListCompareAlpha);
} }
void strListSortAlphaReverse(str_list_t list) void strListSortAlphaReverse(str_list_t list)
{ {
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaReverse); if(list != NULL)
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaReverse);
} }
void strListSortAlphaCase(str_list_t list) void strListSortAlphaCase(str_list_t list)
{ {
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCase); if(list != NULL)
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCase);
} }
void strListSortAlphaCaseReverse(str_list_t list) void strListSortAlphaCaseReverse(str_list_t list)
{ {
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCaseReverse); if(list != NULL)
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCaseReverse);
} }
str_list_t strListDup(str_list_t list) str_list_t strListDup(str_list_t list)
...@@ -506,6 +510,8 @@ str_list_t strListDup(str_list_t list) ...@@ -506,6 +510,8 @@ str_list_t strListDup(str_list_t list)
str_list_t ret; str_list_t ret;
size_t count=0; size_t count=0;
if(list == NULL)
return NULL;
ret = strListInit(); ret = strListInit();
for(; *list; list++) for(; *list; list++)
strListAppend(&ret, *list, count++); strListAppend(&ret, *list, count++);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment