From c9fcea121f9ad8b9c36263ea6254158c8fa793c8 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 30 May 2024 16:57:58 +0200 Subject: [PATCH] rfkill: Avoid using a signed int for an unsigned variable Error: INTEGER_OVERFLOW (CWE-190): [#def37] [important] src/rfkill.c:105:3: underflow: The cast of "event.idx" to a signed type could result in a negative number. 103| break; 104| 105|-> id = get_adapter_id_for_rfkill(event.idx); 106| 107| if (index == id) { Error: INTEGER_OVERFLOW (CWE-190): [#def38] [important] src/rfkill.c:157:2: underflow: The cast of "event.idx" to a signed type could result in a negative number. 155| return TRUE; 156| 157|-> id = get_adapter_id_for_rfkill(event.idx); 158| if (id < 0) 159| return TRUE; --- src/rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rfkill.c b/src/rfkill.c index a0a50d9e4..8a0e48f01 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -55,7 +55,7 @@ struct rfkill_event { }; #define RFKILL_EVENT_SIZE_V1 8 -static int get_adapter_id_for_rfkill(int rfkill_id) +static int get_adapter_id_for_rfkill(uint32_t rfkill_id) { char sysname[PATH_MAX]; int namefd; -- 2.47.3