summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-metadata.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2019-12-26 15:25:35 +0300
committerAmar Tumballi <amarts@gmail.com>2019-12-27 16:59:42 +0000
commit7656aec3b9ef60592c8cf251dfb5cdb6088cd328 (patch)
treef746427618b260c3ad759437cc1bb62395019463 /xlators/storage/posix/src/posix-metadata.c
parentf5aafeffed3a5363ff200e9300dec5855f680d9c (diff)
Avoid buffer overwrite due to uuid_utoa() misuse
Code like: f(..., uuid_utoa(x), uuid_utoa(y)); is not valid (causes undefined behaviour) because uuid_utoa() uses the only static thread-local buffer which will be overwritten by the subsequent call. All such cases should be converted to use uuid_utoa_r() with explicitly specified buffer. Change-Id: I5e72bab806d96a9dd1707c28ed69ca033b9c8d6c Updates: bz#1193929 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Diffstat (limited to 'xlators/storage/posix/src/posix-metadata.c')
-rw-r--r--xlators/storage/posix/src/posix-metadata.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c
index 63967cf..872a693 100644
--- a/xlators/storage/posix/src/posix-metadata.c
+++ b/xlators/storage/posix/src/posix-metadata.c
@@ -820,6 +820,7 @@ posix_set_ctime_cfr(call_frame_t *frame, xlator_t *this,
};
int ret = 0;
struct posix_private *priv = NULL;
+ char in_uuid_str[64] = {0}, out_uuid_str[64] = {0};
priv = this->private;
@@ -834,9 +835,11 @@ posix_set_ctime_cfr(call_frame_t *frame, xlator_t *this,
"posix set mdata failed, No ctime : in: %s gfid_in:%s "
"out: %s gfid_out:%s",
real_path_in,
- inode_in ? uuid_utoa(inode_in->gfid) : "No inode",
+ (inode_in ? uuid_utoa_r(inode_in->gfid, in_uuid_str)
+ : "No inode"),
real_path_out,
- inode_out ? uuid_utoa(inode_out->gfid) : "No inode");
+ (inode_out ? uuid_utoa_r(inode_out->gfid, out_uuid_str)
+ : "No inode"));
goto out;
}