[PATCH 08/12] android/haltest: Add check for valid channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Channel is got from user and needs to be validated before use as index
in the array.
---
 android/client/if-hl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 17ba16c..a3c351c 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -329,6 +329,10 @@ static void close_channel_p(int argc, const char **argv)
 	}
 
 	channel_id = atoi(argv[4]);
+	if (channel_id >= CHANNEL_ID_SIZE) {
+		haltest_error("Wrong channel id: %u\n", channel_id);
+		return;
+	}
 
 	if (app[app_id].mdep[index].channel[channel_id].fd >= 0) {
 		shutdown(app[app_id].mdep[index].channel[channel_id].fd,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux