All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] sim: validate IMS private identity
Date: Fri, 15 Jan 2021 12:07:10 -0600	[thread overview]
Message-ID: <d70b4ed7-3fb9-1a33-1cf8-e2c28e6bc16a@gmail.com> (raw)
In-Reply-To: <20210115163856.18674-1-geomatsi@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

Hi Sergey,

On 1/15/21 10:38 AM, Sergey Matyukevich wrote:
> Make sure that IMPI is a valid UTF8 string before attempting
> to report it via DBus. Otherwise ofono may crash on dbus assert.
> This field may not be defined for ISIM in use. In this case the
> field still can be read from ISIM, though it will not contain
> a valid UTF8 string. For instance, it may contain 255 0xFF bytes.

Ugh, seems like the SIM vendor can't follow RFC's either?  31.103 Section 4.2.2 
says:

"For contents and syntax of NAI TLV data object values see IETF RFC 2486 [24]. 
The NAI shall be encoded to an octet string according to UTF-8 encoding rules as 
specified in IETF RFC 3629 [27]. The tag value of the NAI TLV data object shall 
be '80'. "

> ---
>   src/sim.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/sim.c b/src/sim.c
> index 33e1245f..f60f5d1b 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -423,7 +423,7 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
>   		ofono_dbus_dict_append(&dict, "ServiceProviderName",
>   					DBUS_TYPE_STRING, &sim->spn);
>   
> -	if (sim->impi)
> +	if (sim->impi && g_utf8_validate(sim->impi, 255, NULL))

Hmm, this would imply that we're setting sim->impi incorrectly..  Also, since we 
have __ofono_sim_get_impi() API, the better fix would be to make sure sim->impi 
is set correctly in impi_read_cb()

>   		ofono_dbus_dict_append(&dict, "ImsPrivateIdentity",
>   					DBUS_TYPE_STRING, &sim->impi);
>   
> _______________________________________________
> ofono mailing list -- ofono(a)ofono.org
> To unsubscribe send an email to ofono-leave(a)ofono.org
> 

Regards,
-Denis

  reply	other threads:[~2021-01-15 18:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 16:38 [PATCH] sim: validate IMS private identity Sergey Matyukevich
2021-01-15 18:07 ` Denis Kenzior [this message]
2021-01-15 19:23   ` Sergey Matyukevich
2021-01-15 19:52     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d70b4ed7-3fb9-1a33-1cf8-e2c28e6bc16a@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.