summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
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/cluster
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/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index 3ce882e..e706228 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -86,6 +86,7 @@ afr_selfheal_recreate_entry(call_frame_t *frame, int dst, int source,
0,
};
unsigned char *newentry = NULL;
+ char dir_uuid_str[64] = {0}, iatt_uuid_str[64] = {0};
priv = this->private;
iatt = &replies[source].poststat;
@@ -93,8 +94,8 @@ afr_selfheal_recreate_entry(call_frame_t *frame, int dst, int source,
gf_msg(this->name, GF_LOG_ERROR, 0, AFR_MSG_SELF_HEAL_FAILED,
"Invalid ia_type (%d) or gfid(%s). source brick=%d, "
"pargfid=%s, name=%s",
- iatt->ia_type, uuid_utoa(iatt->ia_gfid), source,
- uuid_utoa(dir->gfid), name);
+ iatt->ia_type, uuid_utoa_r(iatt->ia_gfid, iatt_uuid_str), source,
+ uuid_utoa_r(dir->gfid, dir_uuid_str), name);
ret = -EINVAL;
goto out;
}