Skip to content

Commit

Permalink
Validate the buffer_ of CustomServiceRequest object before using it to (
Browse files Browse the repository at this point in the history
#210)

instantiate class Cdr

Before we are going to instantiate the fastcdr::Cdr class by using the member
variable buffer_ of class CustomServiceRequest, we must ensure that the buffer_
can not be nullptr.

This patch implements the validation.

Fix #209
  • Loading branch information
Minggang Wang authored and dirk-thomas committed Jun 19, 2018
1 parent 8ee72cd commit 825c6bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ rmw_take_request(
assert(info);

CustomServiceRequest request = info->listener_->getRequest();
eprosima::fastcdr::Cdr deser(*request.buffer_, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::Cdr::DDS_CDR);

if (request.buffer_ != nullptr) {
eprosima::fastcdr::Cdr deser(*request.buffer_, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::Cdr::DDS_CDR);
_deserialize_ros_message(deser, ros_request, info->request_type_support_,
info->typesupport_identifier_);

Expand Down

0 comments on commit 825c6bc

Please sign in to comment.