From 9dc37dd8aa57bea5b86ac4f2a44e31106aeb58ad Mon Sep 17 00:00:00 2001 From: Sakshi Bansal Date: Tue, 3 Feb 2015 10:48:49 +0530 Subject: glusterd: coverity fix for string overflow coverity CID: 1124852 Change-Id: Ifb04ad36b0652474007d2768737722231a5c1df0 BUG: 789278 Signed-off-by: Sakshi Bansal Reviewed-on: https://review.gluster.org/9539 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Kaleb KEITHLEY Tested-by: Kaleb KEITHLEY Reviewed-by: Jeff Darcy --- xlators/mgmt/glusterd/src/glusterd-utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index a66e04934db..47ac842193e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -3284,8 +3284,9 @@ glusterd_import_new_brick (dict_t *peer_data, int32_t vol_count, if (ret) goto out; - strcpy (new_brickinfo->path, path); - strcpy (new_brickinfo->hostname, hostname); + strncpy (new_brickinfo->path, path, sizeof (new_brickinfo->path) - 1); + strncpy (new_brickinfo->hostname, hostname, + sizeof (new_brickinfo->hostname) - 1); new_brickinfo->decommissioned = decommissioned; if (brick_id) strcpy (new_brickinfo->brick_id, brick_id); -- cgit