summaryrefslogtreecommitdiffstats
path: root/network/common.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-02-25 17:48:40 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-02-25 17:48:40 +0200
commit1c195ab280da561f38e54449e4eb3d6882c69b3b (patch)
tree12583570730c9e5a1505416aa445666aa1449f6b /network/common.c
parentd7aa6d1b2d6f3fc48b8287ea04c741078b22f2da (diff)
Fix strncpy length parameters to avoid non-nul-terminated strings
Diffstat (limited to 'network/common.c')
-rw-r--r--network/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/network/common.c b/network/common.c
index 371d74bf..f8967afd 100644
--- a/network/common.c
+++ b/network/common.c
@@ -262,7 +262,7 @@ int bnep_if_up(const char *devname, uint16_t id)
sd = socket(AF_INET6, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, devname, IF_NAMESIZE);
+ strncpy(ifr.ifr_name, devname, IF_NAMESIZE - 1);
ifr.ifr_flags |= IFF_UP;
ifr.ifr_flags |= IFF_MULTICAST;
@@ -352,7 +352,7 @@ int bnep_if_down(const char *devname)
done:
sd = socket(AF_INET6, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, devname, IF_NAMESIZE);
+ strncpy(ifr.ifr_name, devname, IF_NAMESIZE - 1);
ifr.ifr_flags &= ~IFF_UP;