[PATCH 15/17] net/softnic: replace strncpy with strlcpy

Bruce Richardson bruce.richardson at intel.com
Tue Jun 23 18:51:45 CEST 2026


Replace strncpy() with safer strlcpy() which always null-terminates.

Fixes: 7709a63bf178 ("net/softnic: add connection agent")
Cc: stable at dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/softnic/conn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/conn.c b/drivers/net/softnic/conn.c
index 5b031358d5..d34030ce63 100644
--- a/drivers/net/softnic/conn.c
+++ b/drivers/net/softnic/conn.c
@@ -116,8 +116,8 @@ softnic_conn_init(struct softnic_conn_params *p)
 	}
 
 	/* Fill in */
-	strncpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX);
-	strncpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX);
+	strlcpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX + 1);
+	strlcpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX + 1);
 	conn->buf_size = p->buf_size;
 	conn->msg_in_len_max = p->msg_in_len_max;
 	conn->msg_out_len_max = p->msg_out_len_max;
-- 
2.53.0



More information about the dev mailing list