summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKamal Mohanan <kmohanan@redhat.com>2017-09-22 11:33:47 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-10-13 16:23:02 +0000
commit7bf30b0e371ad1170cd0773fe5db335683428777 (patch)
tree91670724e736b9636e1795aafdc04d5525b61b28 /xlators
parentadd7116efa1f31e86f9c00c72c71872b1161370f (diff)
xlators/debug/trace: Coverity Fix BUFFER_SIZE in reconfigure
Problem: strncpy was being called with a source string of length equal to the size argument at lines 3110 and 3114. Solution: Calculate the size argument from the size of the destination argument. Change-Id: I1fed6f8f47c5512b9489bfb3297e7a9911eacbc8 BUG: 789278 Signed-off-by: Kamal Mohanan <kmohanan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/debug/trace/src/trace.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index d9f88bff78e..3ad3769afd8 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -3109,11 +3109,13 @@ reconfigure (xlator_t *this, dict_t *options)
if (gf_fop_list[i])
strncpy (trace_fop_names[i].name,
gf_fop_list[i],
- strlen (gf_fop_list[i]));
+ sizeof (trace_fop_names[i].name));
else
- strncpy (trace_fop_names[i].name, ":O",
- strlen (":O"));
+ strncpy (trace_fop_names[i].name, ":0",
+ sizeof (trace_fop_names[i].name));
trace_fop_names[i].enabled = 1;
+ trace_fop_names[i].name[sizeof (
+ trace_fop_names[i].name) - 1] = 0;
}
}