All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value
@ 2020-09-16 22:34 Sonny Sasaka
  2020-09-17  8:56 ` Bastien Nocera
  2020-09-17 17:05 ` Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Sonny Sasaka @ 2020-09-16 22:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Miao-chen Chou, Yoni Shavit, Alain Michaud

From: Miao-chen Chou <mcchou@chromium.org>

This adds a NULL check before calling sscanf().

Reviewed-by: Yoni Shavit <yshavit@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>

---
 plugins/sixaxis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 939fed759..996f85dd6 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -411,7 +411,7 @@ get_pairing_type_for_device(struct udev_device *udevice, uint16_t *bus,
 
 	hid_id = udev_device_get_property_value(hid_parent, "HID_ID");
 
-	if (sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
+	if (!hid_id || sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
 		return NULL;
 
 	cp = get_pairing(vid, pid);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value
  2020-09-16 22:34 [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value Sonny Sasaka
@ 2020-09-17  8:56 ` Bastien Nocera
  2020-09-17 17:05 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien Nocera @ 2020-09-17  8:56 UTC (permalink / raw)
  To: Sonny Sasaka, linux-bluetooth; +Cc: Miao-chen Chou, Yoni Shavit, Alain Michaud

On Wed, 2020-09-16 at 15:34 -0700, Sonny Sasaka wrote:
> From: Miao-chen Chou <mcchou@chromium.org>
> 
> This adds a NULL check before calling sscanf().
> 
> Reviewed-by: Yoni Shavit <yshavit@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>

Looks good.

Reviewed-by: Bastien Nocera <hadess@hadess.net>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value
  2020-09-16 22:34 [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value Sonny Sasaka
  2020-09-17  8:56 ` Bastien Nocera
@ 2020-09-17 17:05 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2020-09-17 17:05 UTC (permalink / raw)
  To: Sonny Sasaka; +Cc: linux-bluetooth, Miao-chen Chou, Yoni Shavit, Alain Michaud

Hi Sonny,

On Wed, Sep 16, 2020 at 3:37 PM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
>
> From: Miao-chen Chou <mcchou@chromium.org>
>
> This adds a NULL check before calling sscanf().
>
> Reviewed-by: Yoni Shavit <yshavit@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
>
> ---
>  plugins/sixaxis.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
> index 939fed759..996f85dd6 100644
> --- a/plugins/sixaxis.c
> +++ b/plugins/sixaxis.c
> @@ -411,7 +411,7 @@ get_pairing_type_for_device(struct udev_device *udevice, uint16_t *bus,
>
>         hid_id = udev_device_get_property_value(hid_parent, "HID_ID");
>
> -       if (sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
> +       if (!hid_id || sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
>                 return NULL;
>
>         cp = get_pairing(vid, pid);
> --
> 2.26.2

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-17 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 22:34 [PATCH BlueZ v2] sixaxis: Fix crash caused by return of udev_device_get_property_value Sonny Sasaka
2020-09-17  8:56 ` Bastien Nocera
2020-09-17 17:05 ` Luiz Augusto von Dentz

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.