From a121d014610d2dc7aa096d7fdce003b9784e1af0 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 11 May 2014 00:36:20 +0200 Subject: [PATCH] libcephfs.cc: fix possible NULL pointer deref Fix possible NULL pointer dereference of 'inode' in ceph_ll_lookup_inode(). It's not enough to check for 'inode' without assert or error handling before assert for '*inode != NULL' since this doesn't handle the 'inode == NULL' case for the later calls. Fix for: 1192 r = (cmount->get_client())->lookup_parent(*inode, &parent); 5 Dereference of null pointer (loaded from variable 'inode') Signed-off-by: Danny Al-Gaaf --- src/libcephfs.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 88e86ba834706..9fd050946cc92 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1183,9 +1183,9 @@ extern "C" int ceph_ll_lookup_inode( if (r) { return r; } - if (inode) { - assert(*inode != NULL); - } + + assert(inode != NULL); + assert(*inode != NULL); // Request the parent inode, so that we can look up the name Inode *parent; -- 2.39.5