summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2020-04-18 20:47:32 +0200
committerGitHub <noreply@github.com>2020-04-18 20:47:32 +0200
commit034cb57fd2f28b5147223f318e6827aeddc0eadf (patch)
tree96eb199f130f50779c125c544c2c713755205ca3
parent7eea88e8c9720113893810b541b5ebf7ef0ecea8 (diff)
parent1120b9596aaf53399d4739dedb016c731c85f654 (diff)
Merge pull request #6256 from qlyoung/pimd-no-strcpy
-rw-r--r--lib/csv.c6
-rw-r--r--pimd/pim_mlag.c4
-rw-r--r--pimd/pim_rp.c6
3 files changed, 10 insertions, 6 deletions
diff --git a/lib/csv.c b/lib/csv.c
index 445742807c..45ace9777c 100644
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -1,5 +1,5 @@
/* CSV
- * Copyright (C) 2013 Cumulus Networks, Inc.
+ * Copyright (C) 2013,2020 Cumulus Networks, Inc.
*
* This file is part of Quagga.
*
@@ -22,6 +22,8 @@
#include "config.h"
#endif
+#include <zebra.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -419,7 +421,7 @@ void csv_clone_record(csv_t *csv, csv_record_t *in_rec, csv_record_t **out_rec)
}
rec->record = curr;
rec->rec_len = in_rec->rec_len;
- strcpy(rec->record, in_rec->record);
+ strlcpy(rec->record, in_rec->record, csv->buflen);
/* decode record into fields */
csv_decode_record(rec);
diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c
index 47735475f3..78be914cee 100644
--- a/pimd/pim_mlag.c
+++ b/pimd/pim_mlag.c
@@ -583,7 +583,9 @@ static void pim_mlag_process_mlagd_state_change(struct mlag_status msg)
router->mlag_role = msg.my_role;
}
- strcpy(router->peerlink_rif, msg.peerlink_rif);
+ strlcpy(router->peerlink_rif, msg.peerlink_rif,
+ sizeof(router->peerlink_rif));
+
/* XXX - handle the case where we may rx the interface name from the
* MLAG daemon before we get the interface from zebra.
*/
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index a9f1d9335a..ef5f478226 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -1261,11 +1261,11 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
char buf[48];
if (rp_info->rp_src == RP_SRC_STATIC)
- strcpy(source, "Static");
+ strlcpy(source, "Static", sizeof(source));
else if (rp_info->rp_src == RP_SRC_BSR)
- strcpy(source, "BSR");
+ strlcpy(source, "BSR", sizeof(source));
else
- strcpy(source, "None");
+ strlcpy(source, "None", sizeof(source));
if (uj) {
/*
* If we have moved on to a new RP then add the