summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2016-06-10 16:33:04 +0530
committerVijay Bellur <vbellur@redhat.com>2016-07-22 10:41:19 -0700
commit6f037c46c2a015cad37430fd18052bbf6bfffc5c (patch)
tree9cdc4e97cfcdf5fc09023fe40f215377c65bd939
parent96befcf40767cb4ff67868af46637acfabe40bc7 (diff)
tiering/ctr: Fix strcpy coverity
This patch is without a testcase, because it needs additional modification to the existing build method to hit the scenario this fix is intended for, and hence writing a testcase alone won't suffice. Backport of http://review.gluster.org/#/c/14696/ > Reviewed-on: http://review.gluster.org/14696 > Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> > Smoke: Gluster Build System <jenkins@build.gluster.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: N Balachandran <nbalacha@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Dan Lambright <dlambrig@redhat.com> (cherry picked from commit 3474aa85e399a92d3ee9159a2d066d4bd73611a0) Change-Id: I6cffba3e09a023f105dbf2975cc9a3ae1a965c31 BUG: 1346133 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/14721 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 95ce08fea2b..b6ff18934fe 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -126,8 +126,9 @@ ctr_lookup_wind(call_frame_t *frame,
/* Copy hard link info*/
gf_uuid_copy (CTR_DB_REC(ctr_local).pargfid,
*((NEW_LINK_CX(ctr_inode_cx))->pargfid));
- strcpy (CTR_DB_REC(ctr_local).file_name,
- NEW_LINK_CX(ctr_inode_cx)->basename);
+ strncpy (CTR_DB_REC(ctr_local).file_name,
+ NEW_LINK_CX(ctr_inode_cx)->basename,
+ sizeof(CTR_DB_REC(ctr_local).file_name));
/* Since we are in lookup we can ignore errors while
* Inserting in the DB, because there may be many