path: root/xlators/storage/posix/src
diff options
authorYaniv Kaul <>2018-08-21 19:23:01 +0300
committerAmar Tumballi <>2018-08-31 06:14:47 +0000
commitdc6e6b71f87f6f89bb0b69816e92779595d716bd (patch)
treee9fbd7f4384a6ccb05a3537b064588ee30f1b6be /xlators/storage/posix/src
parent058d215174b93b3aa14be99073979f45642e519e (diff)
changelog xlator: strncpy()->sprintf(), reduce strlen()'s
xlators/features/changelog/lib/src/gf-changelog-journal-handler.c xlators/features/changelog/lib/src/gf-changelog.c xlators/features/changelog/src/changelog-helpers.c xlators/features/changelog/src/changelog-misc.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(). Where possible, ensure there's no truncation of the output. Also: - save the result of strlen() and re-use it when possible. - move from strlen to SLEN (sizeof() ) for const strings. - switch a strncpy to a memcpy. Compile-tested only! Change-Id: Ia7a52bce0b243613ad910192ec163c93d944e077 updates: bz#1193929 Signed-off-by: Yaniv Kaul <>
Diffstat (limited to 'xlators/storage/posix/src')
0 files changed, 0 insertions, 0 deletions