mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
Fix possible NULL-pointer dereference in _stat
When given NULL pointers as buffers to _stat, return EFAULT, just as Linux and FreeBSD. Fixes #101.
This commit is contained in:
parent
97b978c6c8
commit
a6bac95fbd
@ -96,6 +96,11 @@ static void _sysio_to_stat_struct(Noux::Sysio const *sysio, struct stat *buf)
|
||||
|
||||
static int _stat(const char *path, struct stat *buf, bool lstat = false)
|
||||
{
|
||||
if ((path == NULL) or (buf == NULL)) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Genode::strncpy(sysio()->stat_in.path, path, sizeof(sysio()->stat_in.path));
|
||||
|
||||
if (!noux()->syscall(Noux::Session::SYSCALL_STAT)) {
|
||||
|
Loading…
Reference in New Issue
Block a user