ofono.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Denis Grigorev <d.grigorev@omp.ru>, ofono@lists.linux.dev
Subject: Re: [PATCH 1/2] smsutil: Check that address fits in memory
Date: Fri, 22 Dec 2023 13:26:05 -0600	[thread overview]
Message-ID: <aa3428d5-1611-4b40-953a-273b2b9b84f8@gmail.com> (raw)
In-Reply-To: <20231221141638.19774-2-d.grigorev@omp.ru>

Hi Denis,

On 12/21/23 08:16, Denis Grigorev wrote:
> This addresses CVE-2023-4233.
> ---
>   src/smsutil.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/src/smsutil.c b/src/smsutil.c
> index 8e57a065..e9551b0d 100644
> --- a/src/smsutil.c
> +++ b/src/smsutil.c
> @@ -647,6 +647,10 @@ gboolean sms_decode_address_field(const unsigned char *pdu, int len,
>   	out->numbering_plan = bit_field(addr_type, 0, 4);
>   
>   	if (out->number_type != SMS_NUMBER_TYPE_ALPHANUMERIC) {
> +		/* BCD number consumes half as much memory */
> +		if (byte_len * 2 >= (int) sizeof(out->address))

Unfortunately this is not precise enough.  The AddressValue field is limited to 
10 bytes, or 20 bcd characters.  sizeof(out->address) is 23 due to UTF8 
representation of certain GSM characters.  It might be better to check addr_len 
above instead.

> +			return FALSE;
> +
>   		extract_bcd_number(pdu + *offset, byte_len, out->address);
>   		*offset += byte_len;
>   	} else {

Regards,
-Denis

  reply	other threads:[~2023-12-22 19:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 14:16 [PATCH 0/2] CVE-2023-4233 and CVE-2023-4234 Denis Grigorev
2023-12-21 14:16 ` [PATCH 1/2] smsutil: Check that address fits in memory Denis Grigorev
2023-12-22 19:26   ` Denis Kenzior [this message]
2023-12-21 14:16 ` [PATCH 2/2] smsutil: Check that submit report " Denis Grigorev
2023-12-22 19:38   ` 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=aa3428d5-1611-4b40-953a-273b2b9b84f8@gmail.com \
    --to=denkenz@gmail.com \
    --cc=d.grigorev@omp.ru \
    --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;
as well as URLs for NNTP newsgroup(s).