diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-06 21:05:20 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-29 18:02:57 +0000 |
| commit | 9f73d2c9b60e551be0229790aeb4e4224d9b2c1a (patch) | |
| tree | fa02eb47ef1d9a7ac8d29b39a2f1faa83515bd55 /lib/command.c | |
| parent | 552d6491f08de30b97af876ab923aea10f1b0a1c (diff) | |
lib: remove some strcpy, strcat
Replace with strlcpy, strlcat
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/command.c b/lib/command.c index 18426e0c51..29f41a712c 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1760,10 +1760,10 @@ static int file_write_config(struct vty *vty) dirfd = open(".", O_DIRECTORY | O_RDONLY); /* if dirfd is invalid, directory sync fails, but we're still OK */ - config_file_sav = XMALLOC( - MTYPE_TMP, strlen(config_file) + strlen(CONF_BACKUP_EXT) + 1); - strcpy(config_file_sav, config_file); - strcat(config_file_sav, CONF_BACKUP_EXT); + size_t config_file_sav_sz = strlen(config_file) + strlen(CONF_BACKUP_EXT) + 1; + config_file_sav = XMALLOC(MTYPE_TMP, config_file_sav_sz); + strlcpy(config_file_sav, config_file, config_file_sav_sz); + strlcat(config_file_sav, CONF_BACKUP_EXT, config_file_sav_sz); config_file_tmp = XMALLOC(MTYPE_TMP, strlen(config_file) + 8); |
