Use sudo_basename() instead of doing the equivalent manually.

This commit is contained in:
Todd C. Miller
2021-02-10 15:14:08 -07:00
parent 41fa461fe1
commit 0663ffbc3f
15 changed files with 38 additions and 101 deletions

View File

@@ -188,17 +188,10 @@ FN_NAME(wordexp)(const char *words, wordexp_t *we, int flags)
void *fn = NULL;
int idx = 0;
name = strrchr(myname, '/');
if (name != NULL)
myname = name + 1;
/* Search for wordexp() but skip this shared object. */
myname = sudo_basename(myname);
while (shl_get(idx++, &desc) == 0) {
name = strrchr(desc->filename, '/');
if (name == NULL)
name = desc->filename;
else
name++;
name = sudo_basename(desc->filename);
if (strcmp(name, myname) == 0)
continue;
if (shl_findsym(&desc->handle, "wordexp", TYPE_PROCEDURE, &fn) == 0)