summaryrefslogtreecommitdiffstats
path: root/xlators/lib/src
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-08-21 19:20:25 +0300
committerAmar Tumballi <amarts@redhat.com>2018-08-31 01:36:34 +0000
commit4b5e3c347cfb80e4749f1963e25d1dd93563f784 (patch)
treef82b1948aec0110f46d3c1e2b230c6971871f413 /xlators/lib/src
parent4996a229f3d09cbb6ed3b9dcdf1d527f36803919 (diff)
bit-rot xlator: strncpy()->sprintf(), reduce strlen()'s
xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c xlators/features/bit-rot/src/stub/bit-rot-stub.c xlators/features/bit-rot/src/stub/bit-rot-stub.h 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(). Ensure sprintf() results do not truncate. Also: - save the result of strlen() and re-use it when possible. - move from strlen to SLEN or sizeof() for const strings. - move ret from int32 to int. Compile-tested only! Change-Id: Ib9b923c45d2d59ac15a105410e8160b252061018 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/lib/src')
0 files changed, 0 insertions, 0 deletions