From 772270f3b6a37a2dd9432541cce436e9b45bb6b9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 20 Apr 2020 14:12:38 -0400 Subject: *: sprintf -> snprintf Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young --- ripd/ripd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ripd') diff --git a/ripd/ripd.c b/ripd/ripd.c index fee700583..f6db713cb 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2972,8 +2972,8 @@ static void rip_distance_show(struct vty *vty, struct rip *rip) " Address Distance List\n"); header = 0; } - sprintf(buf, "%s/%d", inet_ntoa(rn->p.u.prefix4), - rn->p.prefixlen); + snprintf(buf, sizeof(buf), "%s/%d", + inet_ntoa(rn->p.u.prefix4), rn->p.prefixlen); vty_out(vty, " %-20s %4d %s\n", buf, rdistance->distance, rdistance->access_list ? rdistance->access_list -- cgit v1.2.3