diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 18:25:33 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-24 16:26:36 +0000 |
commit | 938849a417727c85f1925dde641b3c6c54c71275 (patch) | |
tree | be05eab666860bd2fb486b5c51eb622e57275efd /contrib/fuse-lib | |
parent | 036327d9e963c84a5222f8d1c7598ab36ad46a4b (diff) |
{cli-cmd-parser|cli-rpc-ops||cli-xml-output}.c: strncpy()->sprintf(), reduce strlen()'s
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 GF_CALLOC() to GF_MALLOC() for the strings.
- move from strlen to sizeof() for const strings.
Compile-tested only!
Change-Id: I3cf49c5401ee100a5db6a4954c3d699ec1814c17
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'contrib/fuse-lib')
0 files changed, 0 insertions, 0 deletions