check strlen before memcmp

1st try to fix #220
This commit is contained in:
Thomas Bernard 2016-11-11 17:24:39 +01:00
parent d45e957cfc
commit ec1c49bb0c
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ startelt(void * d, const char * name, int l)
pdata->curelt = PortMappingEltNone; pdata->curelt = PortMappingEltNone;
for(i = 0; elements[i].str; i++) for(i = 0; elements[i].str; i++)
{ {
if(memcmp(name, elements[i].str, l) == 0) if(strlen(elements[i].str) == l && memcmp(name, elements[i].str, l) == 0)
{ {
pdata->curelt = elements[i].code; pdata->curelt = elements[i].code;
break; break;