From: Danny Al-Gaaf Date: Thu, 13 Nov 2014 16:29:12 +0000 (+0100) Subject: c_read_operations.cc: prevent potential null pointer deref X-Git-Tag: v0.90~25^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9314fe2808e7bd496cf9b2ebc24570e3cfed92e1;p=ceph.git c_read_operations.cc: prevent potential null pointer deref CID 1251575 (#1 of 1): Dereference after null check (FORWARD_NULL) var_deref_model: Passing null pointer key to basic_string, which dereferences it. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/librados/c_read_operations.cc b/src/test/librados/c_read_operations.cc index 33a4675f2e2..d29a2739251 100644 --- a/src/test/librados/c_read_operations.cc +++ b/src/test/librados/c_read_operations.cc @@ -101,7 +101,7 @@ protected: while (i < len) { ASSERT_EQ(0, rados_getxattrs_next(iter, (const char**) &key, (const char**) &val, &val_len)); - if (val_len == 0 && key == NULL && val == NULL) + if (key == NULL || (val_len == 0 && val == NULL)) break; EXPECT_EQ(std::string(keys[i]), std::string(key)); EXPECT_EQ(0, memcmp(vals[i], val, val_len));