diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-10-22 20:36:13 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-10-24 23:30:30 +0200 |
commit | a1d6bbb1f30d638a039db2b5e5ef3ea542590b62 (patch) | |
tree | ecd986cf862feeb71a2e6597e0a065d490b7f6b1 /ospfd/ospf_lsa.c | |
parent | *: add missing \n in some help strings (diff) | |
download | frr-a1d6bbb1f30d638a039db2b5e5ef3ea542590b62.tar.xz frr-a1d6bbb1f30d638a039db2b5e5ef3ea542590b62.zip |
ospfd: fix coverity warnings - security best practices violations
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_lsa.c')
-rw-r--r-- | ospfd/ospf_lsa.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 74d5178f5..4e6769405 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -284,12 +284,12 @@ const char *dump_lsa_key(struct ospf_lsa *lsa) if (lsa != NULL && (lsah = lsa->data) != NULL) { char id[INET_ADDRSTRLEN], ar[INET_ADDRSTRLEN]; - strcpy(id, inet_ntoa(lsah->id)); - strcpy(ar, inet_ntoa(lsah->adv_router)); + strlcpy(id, inet_ntoa(lsah->id), sizeof(id)); + strlcpy(ar, inet_ntoa(lsah->adv_router), sizeof(ar)); sprintf(buf, "Type%d,id(%s),ar(%s)", lsah->type, id, ar); } else - strcpy(buf, "NULL"); + strlcpy(buf, "NULL", sizeof(buf)); return buf; } @@ -2713,7 +2713,8 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi, new->data->type, NULL)); break; default: - strcpy(area_str, inet_ntoa(new->area->area_id)); + strlcpy(area_str, inet_ntoa(new->area->area_id), + sizeof(area_str)); zlog_debug("LSA[%s]: Install %s to Area %s", dump_lsa_key(new), lookup_msg(ospf_lsa_type_msg, |