1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

Everywhere: Port to String::copy_characters_to_buffer()

This commit is contained in:
Sergey Bugaev 2020-08-25 17:32:01 +03:00 committed by Andreas Kling
parent be6cce5530
commit 852454746e
8 changed files with 39 additions and 18 deletions

View file

@ -71,7 +71,12 @@ static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, iface.m_ifname.characters(), IFNAMSIZ);
bool fits = iface.m_ifname.copy_characters_to_buffer(ifr.ifr_name, IFNAMSIZ);
if (!fits) {
dbg() << "Interface name doesn't fit into IFNAMSIZ!";
return;
}
// set the IP address
ifr.ifr_addr.sa_family = AF_INET;

View file

@ -27,9 +27,9 @@
#pragma once
#include "DHCPv4.h"
#include <AK/FlyString.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/UDPServer.h>
#include <LibCore/UDPSocket.h>
@ -39,7 +39,7 @@
#include <sys/socket.h>
struct InterfaceDescriptor {
FlyString m_ifname;
String m_ifname;
MACAddress m_mac_address;
};