File k3b-fixed-crash-on-detecting-writing-speeds.patch of Package k3b

From: Michal Malek <michalm@jabster.pl>
Date: Sat, 09 Jul 2011 22:03:55 +0000
Subject: Fixed crash on detecting writing speeds
X-Git-Url: http://quickgit.kde.org/?p=k3b.git&a=commitdiff&h=61ee818030f29e57556248adf1398b6c9e5ee7de
---
Fixed crash on detecting writing speeds

Device::Device::determineSupportedWriteSpeeds() method
lacked checking if data array is of enough size before accessing
it.

BUG: 272427
FIXED-IN: 2.0.3

Conflicts:

libk3bdevice/k3bdevice.cpp
libk3bdevice/k3bdevice_mmc.cpp
---


--- a/libk3bdevice/k3bdevice.cpp
+++ b/libk3bdevice/k3bdevice.cpp
@@ -3253,7 +3253,7 @@
             int max = 0;
             unsigned char* data = 0;
             unsigned int dataLen = 0;
-            if( modeSense( &data, dataLen, 0x2A ) ) {
+            if( modeSense( &data, dataLen, 0x2A ) && dataLen >= 8 ) {
                 mm_cap_page_2A* mm = (mm_cap_page_2A*)&data[8];
 
                 // MMC1 used byte 18 and 19 for the max write speed

openSUSE Build Service is sponsored by