diff options
| author | Quentin Young <qlyoung@qlyoung.net> | 2021-02-07 22:39:42 -0500 |
|---|---|---|
| committer | Quentin Young <qlyoung@nvidia.com> | 2021-02-09 15:40:40 -0500 |
| commit | 7533cad751eaeabe5626cad636aefa8bf50d7409 (patch) | |
| tree | 866b7345bfbef16c3ae473aa997929598b61d45a /lib/prefix.c | |
| parent | 658186e8b6ad84bd92fa46201901cf75bf3174c2 (diff) | |
*: 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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index 663a87afde..c98e0c1c72 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; } |
