summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c7
1 files changed, 5 insertions, 2 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;