[PATCH] compiler warning: unconstify arg passed to OCTET_STRING_noalloc()

Holger Freyther holger at freyther.de
Thu Apr 14 13:33:37 UTC 2016


> On 14 Apr 2016, at 08:49, Neels Hofmeyr <nhofmeyr at sysmocom.de> wrote:
> 
> This is after the patch to libasn1c, removing str arg constness.
> ---
> src/ranap_msg_factory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
> index bdae92e..461df1a 100644
> --- a/src/ranap_msg_factory.c
> +++ b/src/ranap_msg_factory.c
> @@ -181,7 +181,7 @@ struct msgb *ranap_new_msg_dt(uint8_t sapi, const uint8_t *nas, unsigned int nas
> 		ies.sapi = RANAP_SAPI_sapi_0;
> 
> 	/* Avoid copying + later freeing of OCTET STRING */
> -	OCTET_STRING_noalloc(&ies.nas_pdu, nas, nas_len);
> +	OCTET_STRING_noalloc(&ies.nas_pdu, (uint8_t*)nas, nas_len);

doesn't seem the right way forward. Does OCTET_STRING_noalloc or its users need/want to modify the buffer?

holger


More information about the OpenBSC mailing list