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 4/4] simutil: Make sure set_length on the parent succeeds
Date: Thu, 29 Feb 2024 12:07:36 -0600	[thread overview]
Message-ID: <20240229180746.1671015-4-denkenz@gmail.com> (raw)
In-Reply-To: <20240229180746.1671015-1-denkenz@gmail.com>

---
 src/simutil.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/simutil.c b/src/simutil.c
index a4a8f8c4b230..543ab9962ef2 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -588,8 +588,9 @@ gboolean ber_tlv_builder_set_length(struct ber_tlv_builder *builder,
 	if (new_pos > builder->max)
 		return FALSE;
 
-	if (builder->parent)
-		ber_tlv_builder_set_length(builder->parent, new_pos);
+	if (builder->parent &&
+			!ber_tlv_builder_set_length(builder->parent, new_pos))
+		return FALSE;
 
 	builder->len = new_len;
 
@@ -730,9 +731,9 @@ gboolean comprehension_tlv_builder_set_length(
 	if (builder->pos + new_ctlv_len > builder->max)
 		return FALSE;
 
-	if (builder->parent)
-		ber_tlv_builder_set_length(builder->parent,
-						builder->pos + new_ctlv_len);
+	if (builder->parent && !ber_tlv_builder_set_length(builder->parent,
+						builder->pos + new_ctlv_len))
+		return FALSE;
 
 	len = MIN(builder->len, new_len);
 	if (len > 0 && new_len_size != len_size)
-- 
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 ` [PATCH 3/4] smsutil: Check cbs_dcs_decode return value Denis Kenzior
2024-02-29 18:07 ` Denis Kenzior [this message]
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-4-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