From ea3c3b1d4fb4d93ae2459a3bb1627004a7dd57a8 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 18 Mar 2021 17:56:08 +0000 Subject: [PATCH] Added some checks for the byte buffer allocation in the GTP-U --- srsenb/src/stack/upper/gtpu.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index 3eb9494ea..4a9d0f74d 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -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;