summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/route/cls/ematch/text.c1
-rw-r--r--lib/xfrm/sa.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/route/cls/ematch/text.c b/lib/route/cls/ematch/text.c
index b14c4abb..12a1e747 100644
--- a/lib/route/cls/ematch/text.c
+++ b/lib/route/cls/ematch/text.c
@@ -92,6 +92,7 @@ void rtnl_ematch_text_set_algo(struct rtnl_ematch *e, const char *algo)
struct text_data *t = rtnl_ematch_data(e);
strncpy(t->cfg.algo, algo, sizeof(t->cfg.algo));
+ t->cfg.algo[sizeof(t->cfg.algo) - 1] = '\0';
}
char *rtnl_ematch_text_get_algo(struct rtnl_ematch *e)
diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c
index 995df9fd..15a3661a 100644
--- a/lib/xfrm/sa.c
+++ b/lib/xfrm/sa.c
@@ -1190,6 +1190,7 @@ static int build_xfrm_sa_message(struct xfrmnl_sa *tmpl, int cmd, int flags, str
}
strncpy(auth->alg_name, tmpl->auth->alg_name, sizeof(auth->alg_name));
+ auth->alg_name[sizeof(auth->alg_name) - 1] = '\0';
auth->alg_key_len = tmpl->auth->alg_key_len;
memcpy(auth->alg_key, tmpl->auth->alg_key, (tmpl->auth->alg_key_len + 7) / 8);
if (nla_put(msg, XFRMA_ALG_AUTH, len, auth) < 0) {