Re: [PATCH 2/2] smsutil: check status report fits in buffer

Marcel Holtmann <[email protected]>
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
Hi Sicelo,

> Fixes CVE-2023-4232
> ---
> src/smsutil.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/src/smsutil.c b/src/smsutil.c
> index bdb1d04f..8c1aaad3 100644
> --- a/src/smsutil.c
> +++ b/src/smsutil.c
> @@ -1077,6 +1077,9 @@ static gboolean decode_status_report(const unsigned char *pdu, int len,
> if ((len - offset) < expected)
> return FALSE;
> 
> + if (expected > (int)sizeof(out->status_report.ud))
> + return FALSE;
> +

every time we do casting, I would asked myself if the variable really has the right type and if casting could be avoided.

For example, what is the reason that sms_udl_in_bytes() returns int instead of size_t or unsigned int? Denis?

Regards

Marcel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.