X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_cmdline%2Fcmdline_parse.c;h=961f9befdc1cf90391a4582a45b4eb47e3e1cbbb;hb=refs%2Fheads%2Fupstream-18.05-stable;hp=e88e4e110f8b53ade8a5a64bc2505fe9e24dec90;hpb=9f3a8cb4cfe59ea63e267f69700fb0fde13d7dd3;p=deb_dpdk.git diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index e88e4e11..961f9bef 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -251,7 +251,7 @@ cmdline_parse(struct cmdline *cl, const char * buf) } #ifdef RTE_LIBRTE_CMDLINE_DEBUG - snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf); + strlcpy(debug_buf, buf, (linelen > 64 ? 64 : linelen)); debug_printf("Parse line : len=%d, <%s>\n", linelen, debug_buf); #endif @@ -436,7 +436,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state, if ((unsigned)(comp_len + 1) > size) return 0; - snprintf(dst, size, "%s", comp_buf); + strlcpy(dst, comp_buf, size); dst[comp_len] = 0; return 2; } @@ -513,7 +513,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state, continue; } (*state)++; - l=snprintf(dst, size, "%s", tmpbuf); + l=strlcpy(dst, tmpbuf, size); if (l>=0 && token_hdr.ops->get_help) { token_hdr.ops->get_help(token_p, tmpbuf, sizeof(tmpbuf));