diff options
| author | Mark Stapp <mjs@voltanet.io> | 2021-02-23 15:55:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-23 15:55:02 -0500 |
| commit | 15869cd81d346b5ebfcd2540012d7cb599729bd5 (patch) | |
| tree | 909cea87cf6af4eaab9251a92513d8a1a22746f6 /lib/prefix.c | |
| parent | 33d1282f3d45d59517fb532ec6a60bdf27faecda (diff) | |
| parent | 7533cad751eaeabe5626cad636aefa8bf50d7409 (diff) | |
Merge pull request #8035 from qlyoung/remove-more-sprintf
*: remove more sprintf()
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; } |
