Hi Yang,

> ---
>  src/stkutil.c |   35 +++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/src/stkutil.c b/src/stkutil.c
> index ecd5639..8f4ff39 100644
> --- a/src/stkutil.c
> +++ b/src/stkutil.c
> @@ -687,6 +687,39 @@ static gboolean parse_dataobj_event_list(
>                               STK_DATA_OBJECT_TYPE_EVENT_LIST);
>  }
> 
> +/* Defined in TS 102.223 Section 8.26 */
> +static gboolean parse_dataobj_cause(
> +             struct comprehension_tlv_iter *iter, void *user)
> +{
> +     struct stk_common_byte_array *array = user;
> +     const unsigned char *data;
> +     unsigned int len;
> +
> +     if (comprehension_tlv_iter_get_tag(iter) != STK_DATA_OBJECT_TYPE_CAUSE)
> +             return FALSE;
> +
> +     len = comprehension_tlv_iter_get_length(iter);
> +     if ((len == 1) || (len > 30))
> +             return FALSE;

So if we know the max length is 30 why do we bother g_mallocing here?

> +
> +     if (len == 0) {
> +             array->len = 0;
> +             array->array = NULL;
> +             return TRUE;
> +     }

This won't work unfortunately.  Cause is an optional element and cause with 
length 0 has special meaning.  We will have to include a boolean variable for 
presence information somehow.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to