Skip to content

Commit

Permalink
Fixing dereference issues
Browse files Browse the repository at this point in the history
Some code paths were possibly leading to NULL pointer dereferencing.
A static analysis tool found some NULL pointer dereferencing with its_info and _info.
  • Loading branch information
duartefonseca authored and Duarte Fonseca committed Jan 9, 2025
1 parent d8eaf8c commit 72d7492
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion implementation/routing/src/routing_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data,
} else {
if ((utility::is_response(_data[VSOMEIP_MESSAGE_TYPE_POS])
|| utility::is_error(_data[VSOMEIP_MESSAGE_TYPE_POS]))
&& !its_info->is_local()) {
&& its_info && !its_info->is_local()) {
// We received a response/error but neither the hosting application
// nor another local client could be found --> drop
const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ void service_discovery_impl::handle_eventgroup_subscription(
std::shared_ptr<endpoint_definition> its_unreliable;

// wrong major version
if (_major != _info->get_major()) {
if (_info && _major != _info->get_major()) {
// Create a temporary info object with TTL=0 --> send NACK
auto its_info = std::make_shared<eventgroupinfo>(_service, _instance,
_eventgroup, _major, 0, VSOMEIP_DEFAULT_MAX_REMOTE_SUBSCRIBERS);
Expand Down

0 comments on commit 72d7492

Please sign in to comment.