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 /pimd/pim_cmd.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 'pimd/pim_cmd.c')
| -rw-r--r-- | pimd/pim_cmd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index f99888b3af..cdda7c03aa 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2511,9 +2511,11 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, if (up->reg_state != PIM_REG_NOINFO) { char tmp_str[PIM_REG_STATE_STR_LEN]; - sprintf(state_str + strlen(state_str), ",%s", - pim_reg_state2brief_str(up->reg_state, tmp_str, - sizeof(tmp_str))); + char tmp[sizeof(state_str)]; + snprintf(tmp, sizeof(tmp), ",%s", + pim_reg_state2brief_str(up->reg_state, tmp_str, + sizeof(tmp_str))); + strlcat(state_str, tmp, sizeof(state_str)); } if (uj) { |
