mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
[jerryx-module]Fix a bug in module name comparison (#2079)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
parent
9c013310ab
commit
2865826fc4
@ -179,7 +179,9 @@ jerryx_resolve_native_module (const jerry_value_t canonical_name, /**< canonical
|
||||
/* Look for the module by its name in the list of module definitions. */
|
||||
for (module_p = first_module_p; module_p != NULL; module_p = module_p->next_p)
|
||||
{
|
||||
if (module_p->name_p != NULL && !strncmp ((char *) module_p->name_p, (char *) name_string, name_size))
|
||||
if (module_p->name_p != NULL
|
||||
&& strlen ((char *) module_p->name_p) == name_size
|
||||
&& !strncmp ((char *) module_p->name_p, (char *) name_string, name_size))
|
||||
{
|
||||
/* If we find the module by its name we load it and cache it if it has an on_resolve () and complain otherwise. */
|
||||
(*result) = ((module_p->on_resolve_p) ? module_p->on_resolve_p ()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user