diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-05 23:09:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-06 00:37:47 +0200 |
commit | b96ad76cba891e2ed56496c299158a8b43396ec8 (patch) | |
tree | 895894eb6f8d28aeb2fb0468019f8fb7c5e48971 /Kernel | |
parent | 584fa525eb6a0168caaeb46587dc93eaa060fb2e (diff) | |
download | serenity-b96ad76cba891e2ed56496c299158a8b43396ec8.zip |
Kernel: Use try_copy_kstring_from_user() in IPv4Socket::ioctl()
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Net/IPv4Socket.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index abc28f805d..4dd6d99a43 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -589,11 +589,11 @@ KResult IPv4Socket::ioctl(FileDescription&, unsigned request, Userspace<void*> a if (!copy_from_user(&route, user_route)) return EFAULT; - auto copied_ifname = copy_string_from_user(route.rt_dev, IFNAMSIZ); - if (copied_ifname.is_null()) - return EFAULT; + auto ifname_or_error = try_copy_kstring_from_user(route.rt_dev, IFNAMSIZ); + if (ifname_or_error.is_error()) + 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) return ENODEV; |