[PATCH] Fix cdrom profile enumeration.

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

 



From: Mike Brudevold <mike@xxxxxxxxxxxxx>

---
 extras/cdrom_id/cdrom_id.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index b6797cd..28b1bfe 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -261,6 +261,7 @@ static int cd_profiles(struct udev *udev, int fd)
 	struct scsi_cmd sc;
 	unsigned char header[8];
 	unsigned char profiles[512];
+	unsigned int profiles_end;
 	unsigned int cur_profile;
 	unsigned int len;
 	unsigned int i;
@@ -298,7 +299,8 @@ static int cd_profiles(struct udev *udev, int fd)
 	}
 
 	/* device profiles */
-	for (i = 12; i < profiles[11]; i += 4) {
+	profiles_end = 12 + profiles[11];
+	for (i = 12; i < profiles_end; i += 4) {
 		unsigned int profile = (profiles[i] << 8 | profiles[i + 1]);
 		if (profile == 0)
 			continue;
-- 
1.7.0.4

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

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux