diff options
author | Stefan Schmidt <s.schmidt@samsung.com> | 2013-06-25 15:18:33 +0100 |
---|---|---|
committer | Stefan Schmidt <s.schmidt@samsung.com> | 2013-06-25 15:18:33 +0100 |
commit | 9c1ed31c7675fa8bfd27f366b93b430287ffe552 (patch) | |
tree | 74c200f4120a84408259c9748f1770df7b349922 /src | |
parent | 8deb75463bdb7f8aaa45bebdd3d1570655b66043 (diff) | |
download | efl-9c1ed31c7675fa8bfd27f366b93b430287ffe552.tar.gz |
eina_list: Avoid NULL pointer deref in eina_list_shuffle.
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/eina/eina_list.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c index 5c8b1f8c41..b4707c7b36 100644 --- 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; |