Tip-toe around rpmfiFN() thin ice in fsm
Any pointer gotten from rpmfiFN() is only valid until the next rpmfiFN() call, and here the path can end up inside plugins which may have their own reasons for calling rpmfiFN(). At which point the dest we passed would be invalid. strdup() it to appease ASAN, but this needs a saner solution really.
This commit is contained in:
parent
04b3317e61
commit
7bf818c834
|
@ -736,7 +736,7 @@ static int fsmSetmeta(int fd, int dirfd, const char *path,
|
|||
int nofcaps)
|
||||
{
|
||||
int rc = 0;
|
||||
const char *dest = rpmfiFN(fi);
|
||||
char *dest = xstrdup(rpmfiFN(fi));
|
||||
|
||||
if (!rc && !getuid()) {
|
||||
rc = fsmChown(fd, dirfd, path, st->st_mode, st->st_uid, st->st_gid);
|
||||
|
@ -756,6 +756,7 @@ static int fsmSetmeta(int fd, int dirfd, const char *path,
|
|||
fd, path, dest,
|
||||
st->st_mode, action);
|
||||
}
|
||||
free(dest);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue