summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2018-11-22 21:41:37 +0530
committerAmar Tumballi <amarts@redhat.com>2018-11-24 17:22:12 +0000
commit424978302c7d5d0e03e54a6284c250e951ca694d (patch)
tree882f9bab8b75e09f7cb38010ae0fae779d445993 /libglusterfs/src/common-utils.c
parenta0fdc9202ca37dccab937e166c8ee696d049e08f (diff)
Coverity fix for calling risky function - fscanf
fscanf with %s reads a word, there is no restriction on the length of that word, and the caller is required to pass a sufficiently large buffer for storing thw word. If the input word exceeds the buffer size, it will cause buffer overflow. To fix this, use fscanf with width parameter. Width specifies the maximum number of characters to be read in the current reading operation. Change-Id: If250abf5eb637b9fc2a79047e3599f83254cd4e5 updates: bz#1193929 Signed-off-by: Poornima G <pgurusid@redhat.com>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 47558e76ba4..63cbf13388f 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4332,7 +4332,7 @@ gf_backtrace_fillframes(char *buf)
pos = 0;
for (idx = 0; idx < frames - 2; idx++) {
- ret = fscanf(fp, "%s", callingfn[idx]);
+ ret = fscanf(fp, "%1023s", callingfn[idx]);
if (ret == EOF)
break;
inc = gf_backtrace_append(buf, pos, callingfn[idx]);