[paranoia] [PATCH] fix for possible crash in cdda_identify_scsi() (interface/scan_devices.c)

Gernot Hillier <[email protected]> Mon, 23 Sep 2002 22:28:23 +0200
Newsgroups gmane.comp.audio.cd-paranoia.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I hope this is not the wrong list here as my mail concerns a patch for 
paranoia III, but as I got no response on the user list, I'll try here:

I always got a SIGSEGV in a KDE cd burning tool (k3b) after turning off my 
SCSI-scanner. 

With the help of SuSE, I now found out that the crash was caused by 
cdparanoia-III-alpha9.8.

Please see the attached patch - NULL value of the result of scsi_inquiry() 
wasn't checked correctly which lead to a SIGSEGV in strncmp() naturally...

If this is also not the right place to send patches to, please tell me what it 
is... ;-)

- -- 
Ciao,

Gernot
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9j3lpk997/GGeSeIRAt1EAJ4tIq+9gSTRe371KyOaB/CbhmqZNgCfdE0u
h7lGg+KVteEXk2uHB1DpBxQ=
=nlDN
-----END PGP SIGNATURE-----
cdparanoia-III-alpha9.8-solve-crash.patch (text/x-diff, 536 B)
diff -uNr cdparanoia-III-alpha9.8/interface/scan_devices.c cdparanoia-III-alpha9.8-new/interface/scan_devices.c
--- cdparanoia-III-alpha9.8/interface/scan_devices.c	Mon Mar 26 07:44:01 2001
+++ cdparanoia-III-alpha9.8-new/interface/scan_devices.c	Thu Sep 19 16:47:56 2002
@@ -617,7 +617,7 @@
 
   /* It would seem some TOSHIBA CDROMs gets things wrong */
  
-  if (!strncmp (p + 8, "TOSHIBA", 7) &&
+  if (p && !strncmp (p + 8, "TOSHIBA", 7) &&
       !strncmp (p + 16, "CD-ROM", 6) &&
       p[0] == TYPE_DISK) {
     p[0] = TYPE_ROM;