]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: Fix potential null pointer dereferences where `RGWEnv::get()` is called 50330/head
authorMohamed Awnallah <mohamedmohey2352@gmail.com>
Wed, 1 Mar 2023 16:59:33 +0000 (18:59 +0200)
committerMohamed Awnallah <mohamedmohey2352@gmail.com>
Fri, 19 May 2023 08:53:20 +0000 (11:53 +0300)
commitb8cb558cc35d9fb5c47372a79c6249207a964245
tree190ebee7895ceb8edbb99d6c33b2dfbb6313c1c3
parentf723ec4b448427040ea86db82abe835437712e86
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>
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