No cookie for okan.

fix use-after-free that broke exec's path getting stuff.

``paths'' isn't used anymore, but pointers to within that array are still
used in the next loop. delay freeing it until after then.
This commit is contained in:
oga 2008-04-08 17:38:27 +00:00
parent 9702d4cfd7
commit eb77aabea1

View File

@ -307,7 +307,6 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
ap++; ap++;
} }
*ap = NULL; *ap = NULL;
xfree(path);
for (i = 0; i < NPATHS && paths[i] != NULL; i++) { for (i = 0; i < NPATHS && paths[i] != NULL; i++) {
if ((dirp = opendir(paths[i])) == NULL) if ((dirp = opendir(paths[i])) == NULL)
continue; continue;
@ -351,6 +350,7 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
} }
(void) closedir(dirp); (void) closedir(dirp);
} }
xfree(path);
if ((mi = search_start(&menuq, if ((mi = search_start(&menuq,
search_match_exec, NULL, label, 1)) != NULL) { search_match_exec, NULL, label, 1)) != NULL) {