-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-9m2j-qw67-ph4w
* Refs #20549: Add BB test Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com> * Fix:Fixed integer overflow causing heap overflow When a sub node receives a manipulated DATA sub-message, an Integer Overflow occurs in uint32_t payload_size. This causes a heap buffer overflow error. A comparison statement was inserted before the line that calculates the variable, which fixes the error. Signed-off-by: Desglaneurs <cveissacgleaning@gmail.com> * Refs #20549: Fix review Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com> * Refs #201549: Reset the change data fields before exiting Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com> --------- Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com> Signed-off-by: Desglaneurs <cveissacgleaning@gmail.com> Co-authored-by: Mario Dominguez <mariodominguez@eprosima.com>
- Loading branch information
1 parent
0898631
commit 24fbedc
Showing
17 changed files
with
1,650 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <asio/io_service.hpp> | ||
#include <asio/ip/udp.hpp> | ||
|
||
#include <fastdds/rtps/common/CDRMessage_t.h> | ||
#include <fastrtps/utils/IPLocator.h> | ||
|
||
using namespace eprosima::fastrtps; | ||
using namespace eprosima::fastrtps::rtps; | ||
|
||
struct UDPMessageSender | ||
{ | ||
asio::io_service service; | ||
asio::ip::udp::socket socket; | ||
|
||
UDPMessageSender() | ||
: service() | ||
, socket(service) | ||
{ | ||
socket.open(asio::ip::udp::v4()); | ||
} | ||
|
||
void send( | ||
const CDRMessage_t& msg, | ||
const Locator_t& destination) | ||
{ | ||
std::string addr = IPLocator::toIPv4string(destination); | ||
unsigned short port = static_cast<unsigned short>(destination.port); | ||
auto remote = asio::ip::udp::endpoint(asio::ip::address::from_string(addr), port); | ||
asio::error_code ec; | ||
|
||
socket.send_to(asio::buffer(msg.buffer, msg.length), remote, 0, ec); | ||
} | ||
|
||
}; |
Oops, something went wrong.