]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: NULL check before append value to bufferlist 16752/head
authoramitkuma <amitkuma@redhat.com>
Wed, 2 Aug 2017 17:34:06 +0000 (23:04 +0530)
committeramitkuma <amitkuma@redhat.com>
Fri, 1 Sep 2017 17:58:06 +0000 (23:28 +0530)
Fixes the Coverity Scan Report:

** 1405275 Dereference after null check
CID 1405275 (#1 of 1): Dereference after null check (FORWARD_NULL)
5. var_deref_model: Passing null pointer value to append, which dereferences it.

Signed-off-by: Amit Kumar amitkuma@redhat.com
src/client/Client.cc

index 6b34e4a330e43df4983fc48be64fd78045675a49..3116a1b800d64ca7411638f6f104d57f6667805d 100644 (file)
@@ -10679,6 +10679,7 @@ int Client::_do_setxattr(Inode *in, const char *name, const void *value,
   req->head.args.setxattr.flags = xattr_flags;
 
   bufferlist bl;
+  assert (value || size == 0);
   bl.append((const char*)value, size);
   req->set_data(bl);