3 Commits

Author SHA1 Message Date
yangwei
71a6040f8a 🐞 fix(__mjl_gtp_calc_gtp_hdr_len): 修复长度计算超过包长的错误 2023-07-24 00:14:45 +08:00
yangwei
0c02227c58 🐞 fix(l2tp偏移长度计算时,增加长度判断): 2023-07-23 20:45:16 +08:00
yangwei
320851f683 🐞 fix(gtp计算头部): 计算GTP头部扩展时判断长度 2023-07-23 11:10:15 +08:00
4 changed files with 16 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8...3.10)
set(lib_name MESA_jump_layer)

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8...3.10)
set(MESA_SDK_PREFIX "/opt/MESA" CACHE STRING "MESA Framework Prefix")

View File

@@ -211,6 +211,15 @@ static int __mjl_gtp_calc_gtp_hdr_len(const struct gtp_hdr *gtph)
return -1;
}
if(gtph->msg_type != 0xFF){
return -1;
}
if(ntohs(gtph->len) > 1460 || ntohs(gtph->len) < 40)
{
return -1;
}
if(gtph->flags & (GTP_HDR_FLAG_SEQ_NUM | GTP_HDR_FLAG_N_PDU | GTP_HDR_FLAG_NEXT_EXT_HDR)){
//todo, parse and get seq field
p_ext_hdr += 2; //seq field length is 2 bytes
@@ -384,6 +393,10 @@ static int __mjl_parse_l2tpv2_hdr(const struct l2tp_hdr_v2 *pl2tphdrv2, struct l
if(pl2tphdrv2->offset_present){
offset_size = ntohs(*((unsigned short *)ptr));
if(offset_size > 1460)
{
return -1;
}
ptr += sizeof(short); /* 2 byte fix len offset size */
ptr += offset_size; /* var bytes offset value length */
}

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8...3.10)
include_directories(${CMAKE_SOURCE_DIR}/inc)
include_directories(${MESA_SDK_PREFIX}/include)