From c14eb1767c7cd4f0ce8e0a657308567cc184f3d2 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 10 Jan 2023 14:04:37 -0800 Subject: [PATCH] E2AP: Use tvb_memcpy instead of memcpy(...tvb_get_ptr()) --- epan/dissectors/asn1/e2ap/e2ap.cnf | 2 +- epan/dissectors/packet-e2ap.c | 2 +- epan/dissectors/packet-lorawan.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epan/dissectors/asn1/e2ap/e2ap.cnf b/epan/dissectors/asn1/e2ap/e2ap.cnf index ff668782ee..3d1ab8d67a 100644 --- a/epan/dissectors/asn1/e2ap/e2ap.cnf +++ b/epan/dissectors/asn1/e2ap/e2ap.cnf @@ -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); diff --git a/epan/dissectors/packet-e2ap.c b/epan/dissectors/packet-e2ap.c index af2936b2a2..f3ef527b17 100644 --- a/epan/dissectors/packet-e2ap.c +++ b/epan/dissectors/packet-e2ap.c @@ -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); diff --git a/epan/dissectors/packet-lorawan.c b/epan/dissectors/packet-lorawan.c index b45f13c25a..57493c7e9b 100644 --- a/epan/dissectors/packet-lorawan.c +++ b/epan/dissectors/packet-lorawan.c @@ -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,