From 83304fedb464fe3f97db662ce3e07bd948b7b7d9 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 6 Nov 2018 22:47:41 +0530 Subject: all: fix the format string exceptions Currently, there are possibilities in few places, where a user-controlled (like filename, program parameter etc) string can be passed as 'fmt' for printf(), which can lead to segfault, if the user's string contains '%s', '%d' in it. While fixing it, makes sense to make the explicit check for such issues across the codebase, by making the format call properly. Fixes: CVE-2018-14661 Fixes: bz#1647666 Change-Id: Ib547293f2d9eb618594cbff0df3b9c800e88bde4 Signed-off-by: Amar Tumballi --- xlators/mount/fuse/src/fuse-bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/mount') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 5e208f36175..efb390a9c54 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -5177,7 +5177,7 @@ fuse_priv_dump(xlator_t *this) gf_proc_dump_write("proto_minor", "%u", private->proto_minor); gf_proc_dump_write("volfile", "%s", private->volfile ? private->volfile : "None"); - gf_proc_dump_write("volfile_size", "%d", private->volfile_size); + gf_proc_dump_write("volfile_size", "%" GF_PRI_SIZET, private->volfile_size); gf_proc_dump_write("mount_point", "%s", private->mount_point); gf_proc_dump_write("fuse_thread_started", "%d", (int)private->fuse_thread_started); @@ -5211,7 +5211,7 @@ fuse_history_dump(xlator_t *this) GF_VALIDATE_OR_GOTO(this->name, this->history, out); gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); eh_dump(this->history, NULL, dump_history_fuse); ret = 0; @@ -5232,7 +5232,7 @@ dump_history_fuse(circular_buffer_t *cb, void *data) ".%" GF_PRI_SUSECONDS, cb->tv.tv_usec); gf_proc_dump_write("TIME", "%s", timestr); - gf_proc_dump_write("message", "%s\n", cb->data); + gf_proc_dump_write("message", "%s\n", (char *)cb->data); return 0; } -- cgit