Kernel: Convert network adapter names to Kernel::KString

Another step of incremental progress of removing `AK::String` from the
kernel, to harden against OOM.
This commit is contained in:
Brian Gianforcaro 2021-09-27 17:49:56 -07:00 committed by Brian Gianforcaro
parent 33a9f908a6
commit 2770433d30
Notes: sideshowbarker 2024-07-18 03:15:20 +09:00
16 changed files with 64 additions and 68 deletions

View file

@ -170,9 +170,10 @@ KResult Socket::getsockopt(OpenFileDescription&, int level, int option, Userspac
if (size < IFNAMSIZ)
return EINVAL;
if (m_bound_interface) {
const auto& name = m_bound_interface->name();
auto name = m_bound_interface->name();
auto length = name.length() + 1;
TRY(copy_to_user(static_ptr_cast<char*>(value), name.characters(), length));
auto characters = name.characters_without_null_termination();
TRY(copy_to_user(static_ptr_cast<char*>(value), characters, length));
size = length;
return copy_to_user(value_size, &size);
} else {