mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-05 10:13:15 +00:00
libc: fix DIOCGMEDIASIZE handling in VFS plugin
Use the provided argp pointer to store the result but bail out early if it points into the void. Issue #2558.
This commit is contained in:
parent
2f32308c0b
commit
3b5a34c163
@ -719,6 +719,11 @@ int Libc::Vfs_plugin::ioctl(Libc::File_descriptor *fd, int request, char *argp)
|
|||||||
|
|
||||||
case DIOCGMEDIASIZE:
|
case DIOCGMEDIASIZE:
|
||||||
{
|
{
|
||||||
|
if (!argp) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
opcode = Opcode::IOCTL_OP_DIOCGMEDIASIZE;
|
opcode = Opcode::IOCTL_OP_DIOCGMEDIASIZE;
|
||||||
arg = 0;
|
arg = 0;
|
||||||
break;
|
break;
|
||||||
@ -771,7 +776,7 @@ int Libc::Vfs_plugin::ioctl(Libc::File_descriptor *fd, int request, char *argp)
|
|||||||
/* resolve ambiguity with libc type */
|
/* resolve ambiguity with libc type */
|
||||||
using Genode::int64_t;
|
using Genode::int64_t;
|
||||||
|
|
||||||
int64_t *disk_size = (int64_t*)arg;
|
int64_t *disk_size = (int64_t*)argp;
|
||||||
*disk_size = out.diocgmediasize.size;
|
*disk_size = out.diocgmediasize.size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user