From e6ced04f40ddcf95a501aef180249e828e9ba0b7 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 24 Sep 2012 15:03:56 -0700 Subject: [PATCH] librados: fix use without NULL check in rados_pool_list CID 716911: Dereference after null check (FORWARD_NULL) At (5): Passing null pointer "b" to function "strncat(char *, char const *, size_t)", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.) Signed-off-by: Josh Durgin --- src/librados/librados.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 5aad1a64c7e65..82721a96aa5dd 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -1483,6 +1483,9 @@ extern "C" int rados_pool_list(rados_t cluster, char *buf, size_t len) std::list pools; client->pool_list(pools); + if (!buf) + return -EINVAL; + char *b = buf; if (b) memset(b, 0, len); -- 2.39.5