forked from enlightenment/efl
edje lua2: check string ptr before dereference
Summary: fix null pointer dereference Reviewers: Hermet, kimcinoo, jsuya, raster Reviewed By: kimcinoo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12309
This commit is contained in:
parent
38a4c53a84
commit
d5c8311470
|
@ -491,12 +491,15 @@ _elua_scan_params(lua_State *L, int i, char *params, ...) // Stack usage -
|
|||
size_t len;
|
||||
char *temp = (char *)lua_tolstring(L, j, &len); // Stack usage [-0, +0, m]
|
||||
|
||||
len++; // Cater for the null at the end.
|
||||
*v = malloc(len);
|
||||
if (*v)
|
||||
if (temp)
|
||||
{
|
||||
memcpy(*v, temp, len);
|
||||
n++;
|
||||
len++; // Cater for the null at the end.
|
||||
*v = malloc(len);
|
||||
if (*v)
|
||||
{
|
||||
memcpy(*v, temp, len);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue