All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Matyukevich <geomatsi@gmail.com>
To: ofono@ofono.org
Subject: [PATCH v3 2/3] sim: validate IMS private identity
Date: Sat, 16 Jan 2021 22:21:06 +0300	[thread overview]
Message-ID: <20210116192107.18568-3-geomatsi@gmail.com> (raw)
In-Reply-To: <20210116192107.18568-1-geomatsi@gmail.com>

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

Make sure that IMS private identity is a valid UTF8 string before
setting sim->impi field. Otherwise ofono may crash on dbus assert
when SIM properties are reported via org.ofono.SimManager interface.
---
 src/sim.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sim.c b/src/sim.c
index 33e1245f..793ff64a 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1664,7 +1664,8 @@ static void impi_read_cb(int ok, int total_length, int record,
 		return;
 	}
 
-	sim->impi = g_strndup((const char *)data + 2, data[1]);
+	if (validate_utf8_tlv(data))
+		sim->impi = g_strndup((const char *)data + 2, data[1]);
 }
 
 static void discover_apps_cb(const struct ofono_error *error,

  parent reply	other threads:[~2021-01-16 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 19:21 [PATCH v3 0/3] sim: validate IMS private identity Sergey Matyukevich
2021-01-16 19:21 ` [PATCH v3 1/3] simutil: add validate_utf8_tlv Sergey Matyukevich
2021-01-19 16:04   ` Denis Kenzior
2021-01-16 19:21 ` Sergey Matyukevich [this message]
2021-01-19 16:05   ` [PATCH v3 2/3] sim: validate IMS private identity Denis Kenzior
2021-01-16 19:21 ` [PATCH v3 3/3] unit: add validate_utf8_tlv tests Sergey Matyukevich

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=20210116192107.18568-3-geomatsi@gmail.com \
    --to=geomatsi@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.