diff options
author | Sanju Rakonde <srakonde@redhat.com> | 2017-09-22 18:17:03 +0530 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-10-03 13:28:01 +0000 |
commit | fe5fc91ab9b74b525d4979e09ce13766b3180381 (patch) | |
tree | 2550ac16b91273276dd8d063f45a3343e29ad7a9 /xlators/mgmt | |
parent | faf5939307cafe262ee2135621e1d3e173087e06 (diff) |
glusterd/snapshot: Buffer Size Warning
new_brickinfo->mnt_opts is allocated memory using calloc. So it is
already zeroed out at allocation. we need not to add null character
at the end. we pass one less than maximum size to the strncpy to make
sure that destination string is terminated.
Change-Id: I463dddd2171fb39a509bb75ffcc074d5b1cf7d62
BUG: 789278
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 9e2a75f110f..38fea9dbaa4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -264,7 +264,7 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict, ret = dict_get_str (dict, key, &value); if (!ret) strncpy (new_brickinfo->mnt_opts, value, - sizeof(new_brickinfo->mnt_opts)); + sizeof(new_brickinfo->mnt_opts) - 1); /* If the brick is not of this peer, or snapshot is missed * * for the brick do not replace the xattr for it */ |