char *ep;
/*
- * Test is <= here because str_in_list() should have caught the
+ * Test is >= here because str_in_list() should have caught the
* equal-length case above. Doing it this way guarantees that
* ep[-1] is a valid reference.
*/
- if (strlen(idl->id) <= namelen)
- break;
- ep = idl->id + (strlen(idl->id) - namelen);
+ if (strlen(idl->id) >= namelen)
+ continue;
+ ep = (char *)name + (namelen - strlen(idl->id));
/* a suffix led by . must match */
- if (ep[-1] == '.' && !strcmp(ep, name))
+ if (ep[-1] == '.' && !strcmp(ep, idl->id))
return(TRUE);
}