mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
Kernel: Use try_copy_kstring_from_user() in IPv4Socket::ioctl()
This commit is contained in:
parent
584fa525eb
commit
b96ad76cba
1 changed files with 4 additions and 4 deletions
|
@ -589,11 +589,11 @@ KResult IPv4Socket::ioctl(FileDescription&, unsigned request, Userspace<void*> a
|
||||||
if (!copy_from_user(&route, user_route))
|
if (!copy_from_user(&route, user_route))
|
||||||
return EFAULT;
|
return EFAULT;
|
||||||
|
|
||||||
auto copied_ifname = copy_string_from_user(route.rt_dev, IFNAMSIZ);
|
auto ifname_or_error = try_copy_kstring_from_user(route.rt_dev, IFNAMSIZ);
|
||||||
if (copied_ifname.is_null())
|
if (ifname_or_error.is_error())
|
||||||
return EFAULT;
|
return ifname_or_error.error();
|
||||||
|
|
||||||
auto adapter = NetworkingManagement::the().lookup_by_name(copied_ifname);
|
auto adapter = NetworkingManagement::the().lookup_by_name(ifname_or_error.value()->view());
|
||||||
if (!adapter)
|
if (!adapter)
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue