summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-11-18 13:40:40 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-11-18 13:40:40 +0300
commitece89e96055e0de86bdfcd61650f266581285443 (patch)
treededeed178255224a82630956e8b8427fa8ede626
parente66907e2cbd4567d61bf6c93450f3ac7954f3ff8 (diff)
downloadaccel-ppp-ece89e96055e0de86bdfcd61650f266581285443.tar.gz
accel-ppp-ece89e96055e0de86bdfcd61650f266581285443.zip
ipoe: fixed detection for exceeding of maximum interface name in make_vlan_name function
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 230e033..774e398 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -2206,7 +2206,7 @@ static int get_offer_delay()
static int make_vlan_name(const char *parent, int vid, char *name)
{
- char *ptr1 = name, *endptr = name + IFNAMSIZ - 1;
+ char *ptr1 = name, *endptr = name + IFNAMSIZ;
const char *ptr2 = conf_vlan_name;
char num[5], *ptr3 = num;
@@ -2225,9 +2225,12 @@ static int make_vlan_name(const char *parent, int vid, char *name)
*ptr1++ = *ptr2++;
}
+ if (ptr1 == endptr)
+ return 1;
+
*ptr1 = 0;
- return ptr1 == endptr;
+ return 0;
}
void ipoe_vlan_notify(int ifindex, int vid)