summaryrefslogtreecommitdiffstats
path: root/ldpd/ldp_vty_exec.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 20:12:38 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2020-04-21 01:14:33 +0200
commit772270f3b6a37a2dd9432541cce436e9b45bb6b9 (patch)
treefc7f717a60d056b0300fcf43373a1fff30b94b13 /ldpd/ldp_vty_exec.c
parenttools: add more macros to cocci.h (diff)
downloadfrr-772270f3b6a37a2dd9432541cce436e9b45bb6b9.tar.xz
frr-772270f3b6a37a2dd9432541cce436e9b45bb6b9.zip
*: 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 'ldpd/ldp_vty_exec.c')
-rw-r--r--ldpd/ldp_vty_exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c
index 66c127abd..d317da7b2 100644
--- a/ldpd/ldp_vty_exec.c
+++ b/ldpd/ldp_vty_exec.c
@@ -193,7 +193,8 @@ show_interface_msg_json(struct imsg *imsg, struct show_params *params,
json_object_int_add(json_iface, "adjacencyCount",
iface->adj_cnt);
- sprintf(key_name, "%s: %s", iface->name, af_name(iface->af));
+ snprintf(key_name, sizeof(key_name), "%s: %s", iface->name,
+ af_name(iface->af));
json_object_object_add(json, key_name, json_iface);
break;
case IMSG_CTL_END:
@@ -1328,7 +1329,8 @@ show_l2vpn_binding_msg_json(struct imsg *imsg, struct show_params *params,
json_object_string_add(json_pw, "remoteLabel",
"unassigned");
- sprintf(key_name, "%s: %u", inet_ntoa(pw->lsr_id), pw->pwid);
+ snprintf(key_name, sizeof(key_name), "%s: %u",
+ inet_ntoa(pw->lsr_id), pw->pwid);
json_object_object_add(json, key_name, json_pw);
break;
case IMSG_CTL_END: