From 772270f3b6a37a2dd9432541cce436e9b45bb6b9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 20 Apr 2020 14:12:38 -0400 Subject: *: 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 --- pimd/pim_msdp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pimd/pim_msdp.c') 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(); -- cgit v1.2.3