From 7a84e705ed0b96f479a0fc52fa734e0367bb2af2 Mon Sep 17 00:00:00 2001 From: Harpreet Kaur Date: Thu, 27 Dec 2018 20:20:56 +0530 Subject: posix: buffer_size_warning coverity fix Defect: CID 1398469- Calling strncpy with a maximum size argument of 4096 bytes on destination array key of size 4096 bytes might leave the destination string unterminated. Fix: Using snprintf instead of strncpy. updates: bz#789278 Change-Id: I4fdcd0cbf3af8b2ded94603d92d1ceb4112284c4 Signed-off-by: Harpreet Kaur --- xlators/storage/posix/src/posix-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 922170c3e33..874b0a0171b 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -367,7 +367,7 @@ _posix_get_marker_all_contributions(posix_xattr_filler_t *filler) list_offset = 0; while (remaining_size > 0) { - strncpy(key, list + list_offset, sizeof(key)); + snprintf(key, sizeof(key), "%s", list + list_offset); if (fnmatch(marker_contri_key, key, 0) == 0) { ret = _posix_xattr_get_set_from_backend(filler, key); } -- cgit