glusterd: coverity fix for string overflow

coverity CID: 1124852

Change-Id: Ifb04ad36b0652474007d2768737722231a5c1df0
BUG: 789278
Signed-off-by: Sakshi Bansal <sabansal@redhat.com>
Reviewed-on: https://review.gluster.org/9539
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: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
This commit is contained in:
Sakshi Bansal 2015-02-03 10:48:49 +05:30 committed by Jeff Darcy
parent 3fc67c062b
commit 9dc37dd8aa

View File

@ -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);