]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
test/librbd/fsx.c: fix potential unterminated string handling
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 6 Oct 2014 10:20:09 +0000 (12:20 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 8 Oct 2014 20:56:22 +0000 (22:56 +0200)
commit3bba7ce800274108ac09766c801b82383b970cd2
treebecec4eec801046193d5d144d0531dcac0f62000
parentb414b1dc871adbb5011ec4e09f6ab9ea5cadc363
test/librbd/fsx.c: fix potential unterminated string handling

In case of strncpy() make sure string is '\0' terminated. Before
usage of strcat() check if the destination has enough free space
to concat the char and to terminate the string to prevent illegal
memory access.

Fix for:

CID 1219459 (2 of 2): Buffer not null terminated (BUFFER_SIZE_WARNING)
 buffer_size_warning: Calling strncpy with a maximum size argument of
 1024 bytes on destination array goodfile of size 1024 bytes might
 leave the destination string unterminated.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/librbd/fsx.c