Evas filters: Fix NULL dereference (legacy_strdup)

CID 1210809
CID 1210813

+ remove comment
This commit is contained in:
Jean-Philippe Andre 2014-05-14 17:47:53 +09:00
parent 2a5b3e2482
commit f731f8ffb4
1 changed files with 7 additions and 5 deletions

View File

@ -18,8 +18,6 @@
#define EVAS_FILTER_MODE_GROW (EVAS_FILTER_MODE_LAST+1) #define EVAS_FILTER_MODE_GROW (EVAS_FILTER_MODE_LAST+1)
#define EVAS_FILTER_MODE_BUFFER (EVAS_FILTER_MODE_LAST+2) #define EVAS_FILTER_MODE_BUFFER (EVAS_FILTER_MODE_LAST+2)
// FIXME: The documentation must be updated to respect the Lua language
/* Note on the documentation: /* Note on the documentation:
* To keep it simple, I'm not using any fancy features, only <ul>/<li> lists * To keep it simple, I'm not using any fancy features, only <ul>/<li> lists
* and @a, @b, @c flags from Doxygen. * and @a, @b, @c flags from Doxygen.
@ -1936,13 +1934,17 @@ _legacy_strdup(const char *str)
for (const char *ptr = str; ptr && *ptr; ptr++) for (const char *ptr = str; ptr && *ptr; ptr++)
{ {
if (ptr[0] == '/' && ptr[1] == '/') if (ptr[0] == '/' && ptr[1] == '/')
// Comments {
ptr = strchr(ptr, '\n'); // Comments
ptr = strchr(ptr, '\n');
if (!ptr) break;
}
else if (ptr[0] == '/' && ptr[1] == '*') else if (ptr[0] == '/' && ptr[1] == '*')
{ {
/* Comments */ /* Comments */
ptr = strstr(ptr + 2, "*/"); ptr = strstr(ptr + 2, "*/");
if (ptr) ptr++; if (!ptr) break;
ptr++;
} }
else if (*ptr == '(') else if (*ptr == '(')
eina_strbuf_append_char(dst, '{'); eina_strbuf_append_char(dst, '{');