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 /ospf6d/ospf6_intra.c | |
| parent | 33d1282f3d45d59517fb532ec6a60bdf27faecda (diff) | |
| parent | 7533cad751eaeabe5626cad636aefa8bf50d7409 (diff) | |
Merge pull request #8035 from qlyoung/remove-more-sprintf
*: remove more sprintf()
Diffstat (limited to 'ospf6d/ospf6_intra.c')
| -rw-r--r-- | ospf6d/ospf6_intra.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 5394ba9786..2cffc3a397 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -84,7 +84,7 @@ static char *ospf6_router_lsa_get_nbr_id(struct ospf6_lsa *lsa, char *buf, sizeof(buf1)); inet_ntop(AF_INET, &lsdesc->neighbor_router_id, buf2, sizeof(buf2)); - sprintf(buf, "%s/%s", buf2, buf1); + snprintf(buf, buflen, "%s/%s", buf2, buf1); return buf; } @@ -866,6 +866,7 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, struct in6_addr in6; int prefixnum, cnt = 0; struct ospf6_prefix *prefix; + char tbuf[16]; if (lsa) { intra_prefix_lsa = @@ -898,8 +899,9 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, OSPF6_PREFIX_SPACE( prefix->prefix_length)); inet_ntop(AF_INET6, &in6, buf, buflen); - sprintf(&buf[strlen(buf)], "/%d", - prefix->prefix_length); + snprintf(tbuf, sizeof(tbuf), "/%d", + prefix->prefix_length); + strlcat(buf, tbuf, buflen); return (buf); } } |
