proto: Fix possible buffer overflow due to non null terminated string
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 1 Feb 2016 09:56:20 +0000 (10:56 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 1 Feb 2016 10:09:57 +0000 (11:09 +0100)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
proto.c

diff --git a/proto.c b/proto.c
index eaec91325653da91a74f9f589f52b1f50b443157..b91fcde412e27a69ab72c9e62f24a03582c7b77d 100644 (file)
--- a/proto.c
+++ b/proto.c
@@ -287,7 +287,7 @@ static bool
 parse_prefix_option(struct interface *iface, const char *str, size_t len)
 {
        char buf[128] = {0}, *saveptr;
-       if (len > sizeof(buf))
+       if (len >= sizeof(buf))
                return false;
 
        memcpy(buf, str, len);