diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-07-22 18:21:43 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-08-25 15:41:11 +0200 |
commit | 8d045a9713e01ef4b71b4f171d81ec90fc6987af (patch) | |
tree | a5a782ae1dc70f52f29a3f99c3c655e9e423e3ac | |
parent | dc81e665df27289960c06dee4f33f43a4f17fdaa (diff) | |
download | hardware_replicant_libsamsung-ipc-8d045a9713e01ef4b71b4f171d81ec90fc6987af.tar.gz hardware_replicant_libsamsung-ipc-8d045a9713e01ef4b71b4f171d81ec90fc6987af.tar.bz2 hardware_replicant_libsamsung-ipc-8d045a9713e01ef4b71b4f171d81ec90fc6987af.zip |
utils: network_iface_{up,down}: fix truncated character array
In the netdevice(7) manual we have a character array of a fixed size:
struct ifreq {
char ifr_name[IFNAMSIZ]; /* Interface name */
[...]
};
so we don't need a terminating null byte ('\0').
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | samsung-ipc/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/samsung-ipc/utils.c b/samsung-ipc/utils.c index 44cbe2d..18f5d2b 100644 --- a/samsung-ipc/utils.c +++ b/samsung-ipc/utils.c @@ -295,7 +295,7 @@ int network_iface_up(const char *iface, int domain, int type) return -1; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, IFNAMSIZ); + memcpy(ifr.ifr_name, iface, IFNAMSIZ); fd = socket(domain, type, 0); if (fd < 0) @@ -334,7 +334,7 @@ int network_iface_down(const char *iface, int domain, int type) return -1; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, IFNAMSIZ); + memcpy(ifr.ifr_name, iface, IFNAMSIZ); fd = socket(domain, type, 0); if (fd < 0) |