E2AP: Use tvb_memcpy instead of memcpy(...tvb_get_ptr())

This commit is contained in:
Gerald Combs 2023-01-10 14:04:37 -08:00
parent 9700b8cf8b
commit c14eb1767c
3 changed files with 3 additions and 3 deletions

View File

@ -556,7 +556,7 @@ E2RemovalResponse N e2ap.proc.sout id-E2removal
struct e2ap_private_data *e2ap_data = e2ap_get_private_data(actx->pinfo);
/* Limit length, but really can't be > 5 bytes.. */
e2ap_data->gnb_id_len = MIN((offset-start_offset)/8, MAX_GNB_ID_BYTES);
memcpy(&e2ap_data->gnb_id_bytes, tvb_get_ptr(tvb, start_offset/8, e2ap_data->gnb_id_len), e2ap_data->gnb_id_len);
tvb_memcpy(tvb, &e2ap_data->gnb_id_bytes, start_offset/8, e2ap_data->gnb_id_len);
update_conversation_from_gnb_id(actx);

View File

@ -2225,7 +2225,7 @@ dissect_e2ap_T_gnb_id(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, p
struct e2ap_private_data *e2ap_data = e2ap_get_private_data(actx->pinfo);
/* Limit length, but really can't be > 5 bytes.. */
e2ap_data->gnb_id_len = MIN((offset-start_offset)/8, MAX_GNB_ID_BYTES);
memcpy(&e2ap_data->gnb_id_bytes, tvb_get_ptr(tvb, start_offset/8, e2ap_data->gnb_id_len), e2ap_data->gnb_id_len);
tvb_memcpy(tvb, &e2ap_data->gnb_id_bytes, start_offset/8, e2ap_data->gnb_id_len);
update_conversation_from_gnb_id(actx);

View File

@ -1126,7 +1126,7 @@ dissect_lorawan_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_
memcpy(msg + 6, &dev_address, 4);
memcpy(msg + 10, &fcnt, 4);
msg[15] = frame_length;
memcpy(msg + 16, tvb_get_ptr(tvb, 0, frame_length), frame_length);
tvb_memcpy(tvb, msg + 16, 0, frame_length);
proto_tree_add_checksum(tree, tvb, current_offset, hf_lorawan_mic_type, hf_lorawan_mic_status_type, &ei_lorawan_mic, pinfo, calculate_mic(msg, frame_length + 16, session_key->nwkskey->data), ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
} else {
proto_item *checksum_item = proto_tree_add_checksum(tree, tvb, current_offset, hf_lorawan_mic_type, hf_lorawan_mic_status_type, NULL, pinfo,