summaryrefslogtreecommitdiff
path: root/networking/ifplugd.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-04-02 07:04:44 +0200
committerDenys Vlasenko2010-04-02 07:04:44 +0200
commit37201213ca45f2163abed70a213bb24956b243a8 (patch)
treeb0fb9484e8c322b272e2b07fc31904611d03afdd /networking/ifplugd.c
parentb38af7bd31d98dd6e849354ee94ebafe580e7cc1 (diff)
downloadbusybox-37201213ca45f2163abed70a213bb24956b243a8.zip
busybox-37201213ca45f2163abed70a213bb24956b243a8.tar.gz
ifplugd: more robust interface name match check
function old new delta check_existence_through_netlink 278 308 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ifplugd.c')
-rw-r--r--networking/ifplugd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index f398cca..41b04c4 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -485,8 +485,10 @@ static smallint detect_link(void)
static NOINLINE int check_existence_through_netlink(void)
{
+ int iface_len;
char replybuf[1024];
+ iface_len = strlen(G.iface);
while (1) {
struct nlmsghdr *mhdr;
ssize_t bytes;
@@ -526,8 +528,9 @@ static NOINLINE int check_existence_through_netlink(void)
int len = RTA_PAYLOAD(attr);
if (len > IFNAMSIZ)
len = IFNAMSIZ;
-
- if (strncmp(G.iface, RTA_DATA(attr), len) == 0) {
+ if (iface_len <= len
+ && strncmp(G.iface, RTA_DATA(attr), len) == 0
+ ) {
G.iface_exists = (mhdr->nlmsg_type == RTM_NEWLINK);
}
}