]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rgw: Fix potential null pointer dereferences where `RGWEnv::get()` is called
authorMohamed Awnallah <mohamedmohey2352@gmail.com>
Wed, 1 Mar 2023 16:59:33 +0000 (18:59 +0200)
committerMykola Golub <mgolub@suse.com>
Wed, 13 Sep 2023 13:27:18 +0000 (16:27 +0300)
commit1f780a712a4a819cf9b93c47af4bc25d32dedea4
tree01d2cb5e437496d5663ec9151eaba869e3935b89
parentdf5f79a47f1a49fa97c8e6176ce03e5f5b5b3531
rgw: Fix potential null pointer dereferences where `RGWEnv::get()` is called

Here are the changes I've made:
- Added `RGWEnv::get_optional` with the similar implementation to the `RGWHTTPArgs::get_optional`
- Replaced `RGWEnv::get` in the RGW code where null pointer derefence happens with `RGWEnv::get_optional` as long as it accepts `std::string`
- Otherwise if calling function of `RGWEnv::get` accepts `char*` I leave it as it is
- Added null pointer checks to avoid the null pointer dereference

This commit addresses the following Coverity CIDs:
- "1510310"
- "1510928"
- "1511097"
- "1511555"
- "1511760"
- "1511951"
- "1512003"
- "1512138"
- "1512398"

Fixes: https://tracker.ceph.com/issues/57347
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
(cherry picked from commit b8cb558cc35d9fb5c47372a79c6249207a964245)
src/rgw/rgw_auth_s3.cc
src/rgw/rgw_common.h
src/rgw/rgw_env.cc
src/rgw/rgw_opa.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_swift_auth.cc