Make a malloced copy of "chrootdir" even if it points to an absolute
pathname inside "residue" so "chrootdir" can be simply freed later. PR: bin/53435 Submitted by: Yutaka Ishihara <yutaka at fandc.co.jp> MFC after: 1 week
This commit is contained in:
parent
9bee0009ad
commit
72eaf383f4
@ -1494,9 +1494,11 @@ pass(char *passwd)
|
||||
* c) expand it to the absolute pathname if necessary.
|
||||
*/
|
||||
if (dochroot && residue &&
|
||||
(chrootdir = strtok(residue, " \t")) != NULL &&
|
||||
chrootdir[0] != '/') {
|
||||
asprintf(&chrootdir, "%s/%s", pw->pw_dir, chrootdir);
|
||||
(chrootdir = strtok(residue, " \t")) != NULL) {
|
||||
if (chrootdir[0] != '/')
|
||||
asprintf(&chrootdir, "%s/%s", pw->pw_dir, chrootdir);
|
||||
else
|
||||
chrootdir = strdup(chrootdir); /* so it can be freed */
|
||||
if (chrootdir == NULL)
|
||||
fatalerror("Ran out of memory.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user