@@ -180,8 +180,13 @@ struct msgb *ranap_new_msg_dt(uint8_t sapi, const uint8_t *nas, unsigned int nas
else
ies.sapi = RANAP_SAPI_sapi_0;
- /* Avoid copying + later freeing of OCTET STRING */
- OCTET_STRING_noalloc(&ies.nas_pdu, nas, nas_len);
+ /*
+ * Avoid copying + later freeing of OCTET STRING.
+ * To store the pointer in an OCTET_STRING_t without copying, we need
+ * to un-const *nas. Note: un-consting *nas is safe because ies.nas_pdu
+ * is only used to store the IEs in dt.
+ */
+ OCTET_STRING_noalloc(&ies.nas_pdu, (uint8_t*)nas, nas_len);
/* ies -> dt */
rc = ranap_encode_directtransferies(&dt, &ies);