mirror of
https://github.com/ceph/ceph
synced 2025-01-31 07:22:56 +00:00
libcephfs/test.cc: add assert for result of ceph_getxattr()
Check result of ceph_getxattr() before pass it as parameter to strncmp(). Make sure it's not negative. CID 739411 Argument cannot be negative (CWE-687) Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
8d614665ec
commit
0c70e44630
@ -436,6 +436,7 @@ TEST(LibCephFS, Xattrs) {
|
||||
|
||||
char gxattrv[128];
|
||||
int alen = ceph_getxattr(cmount, test_xattr_file, p, (void *) gxattrv, 128);
|
||||
ASSERT_LT(alen, 0);
|
||||
sprintf(xattrv, "testxattr%c", i);
|
||||
ASSERT_TRUE(!strncmp(xattrv, gxattrv, alen));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user