public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 3/4] smsutil: Check cbs_dcs_decode return value
Date: Thu, 29 Feb 2024 12:07:35 -0600	[thread overview]
Message-ID: <20240229180746.1671015-3-denkenz@gmail.com> (raw)
In-Reply-To: <20240229180746.1671015-1-denkenz@gmail.com>

It is better to explicitly check the return value of cbs_dcs_decode
instead of relying on udhi not being changed due to side-effects.
---
 src/smsutil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index e89b4567f9f4..6fe2bcb4477f 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -1765,7 +1765,8 @@ gboolean sms_udh_iter_init_from_cbs(const struct cbs *cbs,
 	const guint8 *hdr;
 	guint8 max_ud_len;
 
-	cbs_dcs_decode(cbs->dcs, &udhi, NULL, NULL, NULL, NULL, NULL);
+	if (!cbs_dcs_decode(cbs->dcs, &udhi, NULL, NULL, NULL, NULL, NULL))
+		return FALSE;
 
 	if (!udhi)
 		return FALSE;
-- 
2.43.0


  parent reply	other threads:[~2024-02-29 18:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 18:07 [PATCH 1/4] voicecall: Drop unused GError variables Denis Kenzior
2024-02-29 18:07 ` [PATCH 2/4] smsutil: ensure the address length in bytes <= 10 Denis Kenzior
2024-02-29 18:07 ` Denis Kenzior [this message]
2024-02-29 18:07 ` [PATCH 4/4] simutil: Make sure set_length on the parent succeeds Denis Kenzior
2024-02-29 20:40 ` [PATCH 1/4] voicecall: Drop unused GError variables patchwork-bot+ofono

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=20240229180746.1671015-3-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox