summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/locks/src/posix.c7
-rw-r--r--xlators/features/marker/src/marker-quota-helper.c6
-rw-r--r--xlators/features/marker/src/marker-quota.c6
3 files changed, 15 insertions, 4 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index c4ca71cfd7f..22d5990275d 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1062,7 +1062,7 @@ pl_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!name)
goto usual;
- if (strncmp (name, GF_XATTR_CLRLK_CMD, strlen (GF_XATTR_CLRLK_CMD)))
+ if (strncmp (name, GF_XATTR_CLRLK_CMD, SLEN (GF_XATTR_CLRLK_CMD)))
goto usual;
if (clrlk_parse_args (name, &args)) {
@@ -1136,7 +1136,10 @@ pl_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
goto out;
}
- strncpy (key, name, strlen (name));
+ if (snprintf (key, sizeof (key), "%s", name) >= sizeof (key)) {
+ op_ret = -1;
+ goto out;
+ }
if (dict_set_dynstr (dict, key, lk_summary)) {
op_ret = -1;
op_errno = ENOMEM;
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c
index e3e218f8af5..92d4094e7f8 100644
--- a/xlators/features/marker/src/marker-quota-helper.c
+++ b/xlators/features/marker/src/marker-quota-helper.c
@@ -297,7 +297,11 @@ mq_dict_set_contribution (xlator_t *this, dict_t *dict, loc_t *loc,
goto out;
if (contri_key)
- strncpy (contri_key, key, QUOTA_KEY_MAX);
+ if (snprintf(contri_key, QUOTA_KEY_MAX, "%s", key)
+ >= QUOTA_KEY_MAX) {
+ ret = -1;
+ goto out;
+ }
out:
if (ret < 0)
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index f6a0df810bc..620201d616e 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -2169,7 +2169,11 @@ mq_req_xattr (xlator_t *this, loc_t *loc, dict_t *dict,
if (ret < 0)
goto out;
if (size_key)
- strncpy (size_key, key, QUOTA_KEY_MAX);
+ if (snprintf (size_key, QUOTA_KEY_MAX, "%s", key)
+ >= QUOTA_KEY_MAX) {
+ ret = -1;
+ goto out;
+ }
ret = dict_set_uint64 (dict, key, 0);
if (ret < 0)