diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2019-05-29 23:55:17 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-29 23:55:17 -0300 |
| commit | 0ad79902fc5f4219feef1fec2ee7b5dfd3f34f98 (patch) | |
| tree | 603415acae0525e1e09f1a0a2a0c362766783ab3 /lib/command.c | |
| parent | fc37d4fe0d22aafcaac0c71cc41e426ef7b8a71d (diff) | |
| parent | 67c726a10d90b9edc02e99e5a9064d14f9920309 (diff) | |
Merge pull request #4267 from qlyoung/fix-misc-compile-warnings
Fix misc compile warnings, remove strcpy & strcat
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); |
