diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-04-20 14:12:38 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-04-20 19:14:33 -0400 |
| commit | 772270f3b6a37a2dd9432541cce436e9b45bb6b9 (patch) | |
| tree | fc7f717a60d056b0300fcf43373a1fff30b94b13 /zebra/zebra_pbr.c | |
| parent | 3f0cc3ffb3ebbc67ebdc285b8093783ad572fa93 (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 'zebra/zebra_pbr.c')
| -rw-r--r-- | zebra/zebra_pbr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c index c049aa14f6..a53363f086 100644 --- a/zebra/zebra_pbr.c +++ b/zebra/zebra_pbr.c @@ -884,9 +884,8 @@ static void zebra_pbr_display_icmp(struct vty *vty, port = ((zpie->src_port_min << 8) & 0xff00) + (zpie->dst_port_min & 0xff); memset(decoded_str, 0, sizeof(decoded_str)); - sprintf(decoded_str, "%d/%d", - zpie->src_port_min, - zpie->dst_port_min); + snprintf(decoded_str, sizeof(decoded_str), "%d/%d", + zpie->src_port_min, zpie->dst_port_min); vty_out(vty, ":icmp:%s", lookup_msg(icmp_typecode_str, port, decoded_str)); @@ -1129,7 +1128,7 @@ static void zebra_pbr_show_iptable_unit(struct zebra_pbr_iptable *iptable, if (iptable->fragment) { char val_str[10]; - sprintf(val_str, "%d", iptable->fragment); + snprintf(val_str, sizeof(val_str), "%d", iptable->fragment); vty_out(vty, "\t fragment%s %s\n", iptable->filter_bm & MATCH_FRAGMENT_INVERSE_SET ? " not" : "", lookup_msg(fragment_value_str, |
