From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 2/5] client/mgmt: Fix comparison of narrow type with wide type in loop condition
Date: Mon, 28 Apr 2025 15:51:19 -0400 [thread overview]
Message-ID: <20250428195122.2000808-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20250428195122.2000808-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In a loop condition, comparison of a value of a narrow type with a
value of a wide type may result in unexpected behavior if the wider
value is sufficiently large (or small).
Fixes: https://github.com/bluez/bluez/issues/1211
---
client/mgmt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/mgmt.c b/client/mgmt.c
index 1946d65d2fe2..86b5879db8b0 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -571,7 +571,7 @@ static void confirm_name_rsp(uint8_t status, uint16_t len,
static char *eir_get_name(const uint8_t *eir, uint16_t eir_len)
{
- uint8_t parsed = 0;
+ uint16_t parsed = 0;
if (eir_len < 2)
return NULL;
@@ -599,7 +599,7 @@ static char *eir_get_name(const uint8_t *eir, uint16_t eir_len)
static unsigned int eir_get_flags(const uint8_t *eir, uint16_t eir_len)
{
- uint8_t parsed = 0;
+ uint16_t parsed = 0;
if (eir_len < 2)
return 0;
--
2.49.0
next prev parent reply other threads:[~2025-04-28 19:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 19:51 [PATCH BlueZ v2 1/5] main: Fix comparison of narrow type with wide type in loop condition Luiz Augusto von Dentz
2025-04-28 19:51 ` Luiz Augusto von Dentz [this message]
2025-04-28 19:51 ` [PATCH BlueZ v2 3/5] test-runner: Fix potentially overflowing call to snprintf Luiz Augusto von Dentz
2025-04-28 19:51 ` [PATCH BlueZ v2 4/5] client/mgmt: " Luiz Augusto von Dentz
2025-04-28 19:51 ` [PATCH BlueZ v2 5/5] shared/bap: Too few arguments to formatting function Luiz Augusto von Dentz
2025-04-28 21:14 ` [BlueZ,v2,1/5] main: Fix comparison of narrow type with wide type in loop condition bluez.test.bot
2025-04-28 21:40 ` [PATCH BlueZ v2 1/5] " patchwork-bot+bluetooth
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=20250428195122.2000808-2-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.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.