summaryrefslogtreecommitdiff
path: root/src/ipcpd/eth/eth.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-10-09 21:02:14 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-10-10 09:07:13 +0200
commite8b3e880da69f9ac398bfd90015564ef09e948a3 (patch)
treee088904f6bedfb04581f4db7a51a2a352fd8bc93 /src/ipcpd/eth/eth.c
parentee1e7fe6c4d101569d045bcc8b99d7f0779f7e96 (diff)
downloadouroboros-e8b3e880da69f9ac398bfd90015564ef09e948a3.tar.gz
ouroboros-e8b3e880da69f9ac398bfd90015564ef09e948a3.zip
ipcpd: Fix SEGV in eth IPCP
The memcpy of the device name was copying a fixed set of bytes (IFNAMSIZ), but the string conf->dev is usually shorter. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/eth/eth.c')
-rw-r--r--src/ipcpd/eth/eth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index 1bbfac5b..e7a1580c 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -1242,8 +1242,13 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf)
return -1;
}
+ if (strlen(conf->dev) >= IFNAMSIZ) {
+ log_err("Invalid device name: %s.", conf->dev);
+ return -1;
+ }
+
memset(&ifr, 0, sizeof(ifr));
- memcpy(ifr.ifr_name, conf->dev, IFNAMSIZ);
+ strcpy(ifr.ifr_name, conf->dev);
#ifdef BUILD_ETH_DIX
if (conf->ethertype < 0x0600 || conf->ethertype == 0xFFFF) {