netifd : Fix ubus route src mask printing
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 11 Feb 2014 08:31:24 +0000 (08:31 +0000)
committerSteven Barth <steven@midlink.org>
Fri, 14 Feb 2014 19:57:32 +0000 (20:57 +0100)
Fix printing of route src mask attribute when it contains 3 digits

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ubus.c

diff --git a/ubus.c b/ubus.c
index 22b75e4073b24a1cf6d504c1199eaa04c8b58f50..d8768241d2f614aeb789d1affe90cc8ba5a68793 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -497,7 +497,7 @@ interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled)
 
                buf = blobmsg_alloc_string_buffer(&b, "source", buflen);
                inet_ntop(af, &route->source, buf, buflen);
-               snprintf(buf + strlen(buf), 4, "/%u", route->sourcemask);
+               snprintf(buf + strlen(buf), buflen - strlen(buf), "/%u", route->sourcemask);
                blobmsg_add_string_buffer(&b);
 
                blobmsg_close_table(&b, r);