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_msdp.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_msdp.c')
| -rw-r--r-- | pimd/pim_msdp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 52c989e644..b42092a464 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -1574,14 +1574,16 @@ void pim_msdp_init(struct pim_instance *pim, struct thread_master *master) pim->msdp.master = master; char hash_name[64]; - snprintf(hash_name, 64, "PIM %s MSDP Peer Hash", pim->vrf->name); + snprintf(hash_name, sizeof(hash_name), "PIM %s MSDP Peer Hash", + pim->vrf->name); pim->msdp.peer_hash = hash_create(pim_msdp_peer_hash_key_make, pim_msdp_peer_hash_eq, hash_name); pim->msdp.peer_list = list_new(); pim->msdp.peer_list->del = (void (*)(void *))pim_msdp_peer_free; pim->msdp.peer_list->cmp = (int (*)(void *, void *))pim_msdp_peer_comp; - snprintf(hash_name, 64, "PIM %s MSDP SA Hash", pim->vrf->name); + snprintf(hash_name, sizeof(hash_name), "PIM %s MSDP SA Hash", + pim->vrf->name); pim->msdp.sa_hash = hash_create(pim_msdp_sa_hash_key_make, pim_msdp_sa_hash_eq, hash_name); pim->msdp.sa_list = list_new(); |
