mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 14:42:06 +00:00
ospf_packet: scan-build/clang clean up
get the code safer using snprintf().
This commit is contained in:
parent
c31a793b48
commit
89a48046dd
@ -4065,21 +4065,19 @@ void ospf_ls_ack_send_delayed(struct ospf_interface *oi)
|
|||||||
* punt-to-CPU set on them. This may overload the CPU control path that
|
* punt-to-CPU set on them. This may overload the CPU control path that
|
||||||
* can be avoided if the MAC was known apriori.
|
* can be avoided if the MAC was known apriori.
|
||||||
*/
|
*/
|
||||||
#define OSPF_PING_NBR_STR_MAX (8 + 40 + 20)
|
#define OSPF_PING_NBR_STR_MAX (BUFSIZ)
|
||||||
void ospf_proactively_arp(struct ospf_neighbor *nbr)
|
void ospf_proactively_arp(struct ospf_neighbor *nbr)
|
||||||
{
|
{
|
||||||
char ping_nbr[OSPF_PING_NBR_STR_MAX];
|
char ping_nbr[OSPF_PING_NBR_STR_MAX];
|
||||||
char *str_ptr;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!nbr || !nbr->oi || !nbr->oi->ifp)
|
if (!nbr || !nbr->oi || !nbr->oi->ifp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
str_ptr = strcpy(ping_nbr, "ping -c 1 -I ");
|
snprintf(ping_nbr, sizeof(ping_nbr),
|
||||||
str_ptr = strcat(str_ptr, nbr->oi->ifp->name);
|
"ping -c 1 -I %s %s > /dev/null 2>&1 &",
|
||||||
str_ptr = strcat(str_ptr, " ");
|
nbr->oi->ifp->name, inet_ntoa(nbr->address.u.prefix4));
|
||||||
str_ptr = strcat(str_ptr, inet_ntoa(nbr->address.u.prefix4));
|
|
||||||
str_ptr = strcat(str_ptr, " > /dev/null 2>&1 &");
|
|
||||||
ret = system(ping_nbr);
|
ret = system(ping_nbr);
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug("Executed %s %s", ping_nbr,
|
zlog_debug("Executed %s %s", ping_nbr,
|
||||||
|
Loading…
Reference in New Issue
Block a user