summaryrefslogtreecommitdiff
path: root/lib/plist.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 14:12:38 -0400
committerQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 19:14:33 -0400
commit772270f3b6a37a2dd9432541cce436e9b45bb6b9 (patch)
treefc7f717a60d056b0300fcf43373a1fff30b94b13 /lib/plist.c
parent3f0cc3ffb3ebbc67ebdc285b8093783ad572fa93 (diff)
*: 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 <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/plist.c')
-rw-r--r--lib/plist.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/plist.c b/lib/plist.c
index 67a91e2a0d..d18d51618a 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -1961,10 +1961,9 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
char buf_a[BUFSIZ];
char buf_b[BUFSIZ];
- sprintf(buf_a, "%s/%d",
- inet_ntop(p->family, p->u.val, buf_b,
- BUFSIZ),
- p->prefixlen);
+ snprintf(buf_a, sizeof(buf_a), "%s/%d",
+ inet_ntop(p->family, p->u.val, buf_b, BUFSIZ),
+ p->prefixlen);
json_object_int_add(json_list, "seq", pentry->seq);
json_object_string_add(json_list, "seqPrefixListType",