diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2015-11-18 13:40:40 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2015-11-18 13:40:40 +0300 |
commit | ece89e96055e0de86bdfcd61650f266581285443 (patch) | |
tree | dedeed178255224a82630956e8b8427fa8ede626 | |
parent | e66907e2cbd4567d61bf6c93450f3ac7954f3ff8 (diff) | |
download | accel-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.c | 7 |
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) |