jeyzu pushed a commit to branch master.
commit bc182253a7d8696aebec39599fa9470b8bc80884
Author: Jérémy Zurcher <[email protected]>
Date: Wed Jun 12 15:46:08 2013 +0200
eina_str_split_full_helper: check params, set NULL at the end of token array
---
src/lib/eina/eina_str.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/lib/eina/eina_str.c b/src/lib/eina/eina_str.c
index 1b4d0dc..515f34f 100644
--- a/src/lib/eina/eina_str.c
+++ b/src/lib/eina/eina_str.c
@@ -77,6 +77,13 @@ eina_str_split_full_helper(const char *str,
unsigned int tokens = 0, x;
const char *idx[256] = {NULL};
+ if ((!str) || (!delim))
+ {
+ if (elements)
+ *elements = 0;
+
+ return NULL;
+ }
if (max_tokens < 0) max_tokens = 0;
if (max_tokens == 1)
{
@@ -101,6 +108,7 @@ eina_str_split_full_helper(const char *str,
if (elements)
*elements = 1;
str_array[0] = s;
+ str_array[1] = NULL;
return str_array;
}
dlen = strlen(delim);
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev