diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index c918de3f3..6bd287f58 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -1145,8 +1145,8 @@ s1ap_nas_transport::handle_esm_information_response(srslte::byte_buffer_t *nas_m m_s1ap_log->info("ESM Info: EPS bearer id %d\n",esm_info_resp.eps_bearer_id); if(esm_info_resp.apn_present) { - m_s1ap_log->info("ESM Info: APN %s\n",esm_info_resp.apn.apn.c_str()); - m_s1ap_log->console("ESM Info: APN %s\n",esm_info_resp.apn.apn.c_str()); + m_s1ap_log->info("ESM Info: APN %s\n",esm_info_resp.apn.apn); + m_s1ap_log->console("ESM Info: APN %s\n",esm_info_resp.apn.apn); } if(esm_info_resp.protocol_cnfg_opts_present) { diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 4a7a65997..2b76ef84c 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -1226,7 +1226,9 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id) { esm_info_resp.apn_present = false; } else { esm_info_resp.apn_present = true; - esm_info_resp.apn.apn = cfg.apn; + int len = std::min((int)cfg.apn.length(), LIBLTE_STRING_LEN); + strncpy(esm_info_resp.apn.apn, cfg.apn.c_str(), len); + esm_info_resp.apn.apn[len - 1] = '\0'; } esm_info_resp.protocol_cnfg_opts_present = false;