summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-05-06 23:28:55 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-05-29 20:03:26 +0200
commit2e600d75293e34196e586a9ff96be819dd5ba1f4 (patch)
tree369119210c1415802ee8d945c57e9eeb797364f4 /vtysh
parentpbrd: strcpy -> strlcpy (diff)
downloadfrr-2e600d75293e34196e586a9ff96be819dd5ba1f4.tar.xz
frr-2e600d75293e34196e586a9ff96be819dd5ba1f4.zip
vtysh: strcpy -> strlcpy, strcat -> strlcat
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index a0b119c3e..51d5e4291 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -681,7 +681,7 @@ int vtysh_mark_file(const char *filename)
while (fgets(vty->buf, VTY_BUFSIZ, confp)) {
lineno++;
tried = 0;
- strcpy(vty_buf_copy, vty->buf);
+ strlcpy(vty_buf_copy, vty->buf, VTY_BUFSIZ);
vty_buf_trimmed = trim(vty_buf_copy);
switch (vty->node) {
@@ -2702,9 +2702,10 @@ static void backup_config_file(const char *fbackup)
{
char *integrate_sav = NULL;
- integrate_sav = malloc(strlen(fbackup) + strlen(CONF_BACKUP_EXT) + 1);
- strcpy(integrate_sav, fbackup);
- strcat(integrate_sav, CONF_BACKUP_EXT);
+ size_t integrate_sav_sz = strlen(fbackup) + strlen(CONF_BACKUP_EXT) + 1;
+ integrate_sav = malloc(integrate_sav_sz);
+ strlcpy(integrate_sav, fbackup, integrate_sav_sz);
+ strlcat(integrate_sav, CONF_BACKUP_EXT, integrate_sav_sz);
/* Move current configuration file to backup config file. */
if (unlink(integrate_sav) != 0) {