Added some checks for the byte buffer allocation in the GTP-U

This commit is contained in:
Pedro Alvarez 2021-03-18 17:56:08 +00:00 committed by Francisco Paisana
parent cade7c8104
commit ea3c3b1d4f
1 changed files with 8 additions and 0 deletions

View File

@ -458,6 +458,10 @@ void gtpu::error_indication(in_addr_t addr, in_port_t port, uint32_t err_teid)
gtpu_header_t header = {};
unique_byte_buffer_t pdu = make_byte_buffer();
if (pdu == nullptr) {
logger.error("Could not allocate byte buffer for error indication");
return;
}
// header
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
@ -488,6 +492,10 @@ void gtpu::echo_response(in_addr_t addr, in_port_t port, uint16_t seq)
gtpu_header_t header = {};
unique_byte_buffer_t pdu = make_byte_buffer();
if (pdu == nullptr) {
logger.error("Could not allocate byte buffer for echo response");
return;
}
// header
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;