diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 20:39:16 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-09-07 03:39:50 +0000 |
commit | ce17a3a66dd15f09d1bf5404f7f3dee860ca6f8c (patch) | |
tree | 41b7b2baafd869b611f4c741df7cd262e17a3bb0 /NEWS | |
parent | 21e78061a24a094067fb267b77c4ffaae7e762f3 (diff) |
multiple xlators: strncpy()->sprintf(), reduce strlen()'s
xlators/cluster/afr/src/afr-common.c
xlators/cluster/dht/src/dht-common.c
xlators/cluster/dht/src/dht-rebalance.c
xlators/cluster/stripe/src/stripe-helpers.c
strncpy may not be very efficient for short strings copied into
a large buffer: If the length of src is less than n,
strncpy() writes additional null bytes to dest to ensure
that a total of n bytes are written.
Instead, use snprintf().
Also:
- save the result of strlen() and re-use it when possible.
- move from strlen to SLEN (sizeof() ) for const strings.
Compile-tested only!
Change-Id: Icdf79dd3d9f9ff120e4720ff2b8bd016df575c38
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'NEWS')
0 files changed, 0 insertions, 0 deletions