mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 22:23:08 +00:00
kern___realpathat(): honor uio_seg argument
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47739
This commit is contained in:
parent
67218bcea8
commit
bde575b273
@ -3290,7 +3290,15 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf,
|
||||
&freebuf, &size);
|
||||
}
|
||||
if (error == 0) {
|
||||
error = copyout(retbuf, buf, min(strlen(retbuf) + 1, size));
|
||||
size_t len;
|
||||
|
||||
len = strlen(retbuf) + 1;
|
||||
if (size < len)
|
||||
error = ENAMETOOLONG;
|
||||
else if (pathseg == UIO_USERSPACE)
|
||||
error = copyout(retbuf, buf, len);
|
||||
else
|
||||
memcpy(buf, retbuf, len);
|
||||
free(freebuf, M_TEMP);
|
||||
}
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user