New upstream version 18.05
[deb_dpdk.git] / lib / librte_cmdline / cmdline_parse.c
index e88e4e1..961f9be 100644 (file)
@@ -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));