commit ceb0fa9803b27057c7a8413cf50a51f428f5d792
Author: Oswald Buddenhagen <[email protected]>
Date: Thu Jul 4 09:09:17 2024 +0200
don't try to qsort() NULL array
while this actually works due to the array size being zero, it's
undefined behavior which makes gcc eliminate a subsequent null check in
the calling function.
src/main_sync.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main_sync.c b/src/main_sync.c
index 226e324..fff944c 100644
--- a/src/main_sync.c
+++ b/src/main_sync.c
@@ -186,7 +186,8 @@ filter_boxes( string_list_t *boxes, const char *prefix,
string_list_t *patterns
boxarr[num] = NULL;
}
}
- qsort( boxarr, num, sizeof(*boxarr), cmp_box_names );
+ if (boxarr)
+ qsort( boxarr, num, sizeof(*boxarr), cmp_box_names );
return boxarr;
}
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel