summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@qlyoung.net>2021-02-08 04:39:42 +0100
committerQuentin Young <qlyoung@nvidia.com>2021-02-09 21:40:40 +0100
commit7533cad751eaeabe5626cad636aefa8bf50d7409 (patch)
tree866b7345bfbef16c3ae473aa997929598b61d45a /lib/prefix.c
parentMerge pull request #7937 from pjdruddy/topotest-evpn-svi-advertise (diff)
downloadfrr-7533cad751eaeabe5626cad636aefa8bf50d7409.tar.xz
frr-7533cad751eaeabe5626cad636aefa8bf50d7409.zip
*: remove more sprintf()
Should be just a couple non-development, non-test occurrences of this function left now. Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 663a87afd..c98e0c1c7 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -1160,7 +1160,7 @@ in_addr_t ipv4_broadcast_addr(in_addr_t hostaddr, int masklen)
ex.) "1.1.0.0" "255.255.0.0" => "1.1.0.0/16"
ex.) "1.0.0.0" NULL => "1.0.0.0/8" */
int netmask_str2prefix_str(const char *net_str, const char *mask_str,
- char *prefix_str)
+ char *prefix_str, size_t prefix_str_len)
{
struct in_addr network;
struct in_addr mask;
@@ -1193,7 +1193,7 @@ int netmask_str2prefix_str(const char *net_str, const char *mask_str,
return 0;
}
- sprintf(prefix_str, "%s/%d", net_str, prefixlen);
+ snprintf(prefix_str, prefix_str_len, "%s/%d", net_str, prefixlen);
return 1;
}