projects
/
platform
/
upstream
/
efl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8deb754
)
eina_list: Avoid NULL pointer deref in eina_list_shuffle.
author
Stefan Schmidt
<s.schmidt@samsung.com>
Tue, 25 Jun 2013 14:18:33 +0000
(15:18 +0100)
committer
Stefan Schmidt
<s.schmidt@samsung.com>
Tue, 25 Jun 2013 14:18:33 +0000
(15:18 +0100)
If we have a valid but empty, n = 0, list we never enter the loop
and shuffled_last might still be NULL. Avoid this case by checking
explicitly for n = 0 before.
src/lib/eina/eina_list.c
patch
|
blob
|
history
diff --git
a/src/lib/eina/eina_list.c
b/src/lib/eina/eina_list.c
index
5c8b1f8
..
b4707c7
100644
(file)
--- a/
src/lib/eina/eina_list.c
+++ b/
src/lib/eina/eina_list.c
@@
-1111,6
+1111,9
@@
eina_list_shuffle(Eina_List *list, Eina_Random_Cb func)
n = accounting->count;
shuffled_list = shuffled_last = NULL;
+ if (n == 0)
+ return NULL;
+
if (n == 1)
return list;