summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2016-06-16 11:24:30 -0400
committerJeff Darcy <jdarcy@redhat.com>2016-06-16 12:31:44 -0700
commitae4a410cb411c3f1b5ebac9d49d47e2fc00c9a74 (patch)
treed5cd8b92b80f6565e53ead9d89447360d36a14aa /xlators/mgmt/glusterd/src/glusterd-geo-rep.c
parentb8ac20e888fbacad9d90cd8f1c6ff8579a5cefe9 (diff)
glusterd: unsafe strcat, strncat use in glusterd_op_stage_gsync_create()
SuSE build system post-compile analysis aborts pkg build due to unsafe strcat, strncat usage. Change-Id: I52ac41e1172d0c1e5695a91b9f731cc9e7de4db4 BUG: 1347354 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/14745 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-geo-rep.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 04f2f14af0c..13407c22df9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -2961,8 +2961,7 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)
char *georep_session_wrkng_dir = NULL;
struct slave_vol_config slave1 = {{0},};
int type = 0;
- char old_slave_url_info[SLAVE_URL_INFO_MAX] = {0};
- char *old_slave_url = NULL;
+ char old_slave_url[SLAVE_URL_INFO_MAX] = {0};
char old_confpath[PATH_MAX] = {0};
gf_boolean_t is_running = _gf_false;
int ret_status = 0;
@@ -3258,26 +3257,21 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)
/* Do the check, only if different slave host/slave user */
if (is_different_slavehost || is_different_username) {
- ret = snprintf (old_confpath, sizeof(old_confpath) - 1,
- "%s/"GEOREP"/%s_%s_%s/gsyncd.conf",
- conf->workdir, volinfo->volname,
- slave1.old_slvhost, slave_vol);
+ (void) snprintf (old_confpath, sizeof(old_confpath) - 1,
+ "%s/"GEOREP"/%s_%s_%s/gsyncd.conf",
+ conf->workdir, volinfo->volname,
+ slave1.old_slvhost, slave_vol);
/* construct old slave url with (old) slave host */
- old_slave_url = old_slave_url_info;
- strncpy (old_slave_url, slave1.old_slvhost,
- sizeof(old_slave_url_info));
- old_slave_url = strcat (old_slave_url, "::");
- old_slave_url = strncat (old_slave_url, slave_vol,
- sizeof(old_slave_url_info));
-
- ret = glusterd_check_gsync_running_local (
- volinfo->volname,
- old_slave_url,
- old_confpath,
- &is_running);
+ (void) snprintf (old_slave_url,
+ sizeof(old_slave_url) - 1,
+ "%s::%s", slave1.old_slvhost,
+ slave_vol);
+
+ ret = glusterd_check_gsync_running_local (volinfo->volname,
+ old_slave_url, old_confpath, &is_running);
if (_gf_true == is_running) {
- snprintf (errmsg, sizeof(errmsg), "Geo"
+ (void) snprintf (errmsg, sizeof(errmsg), "Geo"
"-replication session between %s and %s"
" is still active. Please stop the "
"session and retry.",