glusterd : coverity fix for string overflow
CID : 1357872, 1357873, 1351695 BUG: 789278 Change-Id: I2ee01a6054326f35de621ee7a1f2afd09c5738fe Signed-off-by: Muthu-vigneshwaran <mvignesh@redhat.com> Reviewed-on: http://review.gluster.org/15989 Tested-by: Muthu Vigneshwaran Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Manikandan Selvaganesh <manikandancs333@gmail.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
This commit is contained in:
parent
ca13525a5d
commit
b214b643d6
@ -735,7 +735,8 @@ glusterd_create_sub_tier_volinfo (glusterd_volinfo_t *volinfo,
|
|||||||
memcpy (&(*dup_volinfo)->tier_info, &volinfo->tier_info,
|
memcpy (&(*dup_volinfo)->tier_info, &volinfo->tier_info,
|
||||||
sizeof (volinfo->tier_info));
|
sizeof (volinfo->tier_info));
|
||||||
|
|
||||||
strcpy ((*dup_volinfo)->volname, new_volname);
|
strncpy ((*dup_volinfo)->volname, new_volname,
|
||||||
|
sizeof((*dup_volinfo)->volname)-1);
|
||||||
|
|
||||||
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
|
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
|
||||||
i++;
|
i++;
|
||||||
@ -3463,7 +3464,8 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
|
|||||||
ret = glusterd_volinfo_new (&new_volinfo);
|
ret = glusterd_volinfo_new (&new_volinfo);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
strncpy (new_volinfo->volname, volname, strlen (volname));
|
strncpy (new_volinfo->volname, volname,
|
||||||
|
sizeof(new_volinfo->volname) - 1);
|
||||||
|
|
||||||
memset (key, 0, sizeof (key));
|
memset (key, 0, sizeof (key));
|
||||||
snprintf (key, sizeof (key), "%s%d.type", prefix, count);
|
snprintf (key, sizeof (key), "%s%d.type", prefix, count);
|
||||||
|
@ -2196,7 +2196,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy (volinfo->volname, volname, strlen (volname));
|
strncpy (volinfo->volname, volname, sizeof(volinfo->volname) - 1);
|
||||||
GF_ASSERT (volinfo->volname);
|
GF_ASSERT (volinfo->volname);
|
||||||
|
|
||||||
ret = dict_get_int32 (dict, "type", &volinfo->type);
|
ret = dict_get_int32 (dict, "type", &volinfo->type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user