summaryrefslogtreecommitdiffstats
path: root/pimd/mtracebis.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 /pimd/mtracebis.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 'pimd/mtracebis.c')
-rw-r--r--pimd/mtracebis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pimd/mtracebis.c b/pimd/mtracebis.c
index 2f10abcce..1b812de92 100644
--- a/pimd/mtracebis.c
+++ b/pimd/mtracebis.c
@@ -108,7 +108,7 @@ static const char *rtg_proto_str(enum mtrace_rtg_proto proto)
case MTRACE_RTG_PROTO_PIM_ASSERT:
return "PIM assert";
default:
- sprintf(buf, "unknown protocol (%d)", proto);
+ snprintf(buf, sizeof(buf), "unknown protocol (%d)", proto);
return buf;
}
}
@@ -161,7 +161,7 @@ static const char *fwd_code_str(enum mtrace_fwd_code code)
case MTRACE_FWD_CODE_ADMIN_PROHIB:
return "admin. prohib.";
default:
- sprintf(buf, "unknown fwd. code (%d)", code);
+ snprintf(buf, sizeof(buf), "unknown fwd. code (%d)", code);
return buf;
}
}