eina_str_split_full_helper: check params, set NULL at the end of token array

This commit is contained in:
Jérémy Zurcher 2013-06-12 15:46:08 +02:00
parent 1d3fd66860
commit bc182253a7
1 changed files with 8 additions and 0 deletions

View File

@ -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);