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_rib.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_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 2dbe907751..447f3dc28d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2456,11 +2456,12 @@ static void _route_entry_dump_nh(const struct route_entry *re, switch (nexthop->type) { case NEXTHOP_TYPE_BLACKHOLE: - sprintf(nhname, "Blackhole"); + snprintf(nhname, sizeof(nhname), "Blackhole"); break; case NEXTHOP_TYPE_IFINDEX: ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id); - sprintf(nhname, "%s", ifp ? ifp->name : "Unknown"); + snprintf(nhname, sizeof(nhname), "%s", + ifp ? ifp->name : "Unknown"); break; case NEXTHOP_TYPE_IPV4: /* fallthrough */ |
