[Utopia] Fix for hal segfault in get_read_write_speed()



Hi!

Several Ubuntu users reported that hal does not start up properly. I
debugged this and found out that hald/linux/linux_dvd_rw_utils.c
contains an unchecked buffer access which causes a segfault.

The attached patch fixes that; it might not be the most correct
solution, but it works. The error is still present in 0.2.98; I made
the fix in 0.2.92, but the patch should still apply.

Thanks,

Martin
-- 
Martin Pitt                       http://www.piware.de
Ubuntu Developer            http://www.ubuntulinux.org
Debian GNU/Linux Developer       http://www.debian.org
diff -ru hal-0.2.92.orig/hald/linux/linux_dvd_rw_utils.c hal-0.2.92/hald/linux/linux_dvd_rw_utils.c
--- hal-0.2.92.orig/hald/linux/linux_dvd_rw_utils.c	2004-09-21 13:44:06.228636984 +0200
+++ hal-0.2.92/hald/linux/linux_dvd_rw_utils.c	2004-09-21 13:49:59.785888112 +0200
@@ -343,7 +343,10 @@
 		*write_speed = p[28] << 8 | p[29];
 	}
 
-	*read_speed = p[8] << 8 | p[9];
+	if (len >= hlen+9)
+	    *read_speed = p[8] << 8 | p[9];
+	else
+	    *read_speed = 0;
 
 	free (page2A);
 

Attachment: signature.asc
Description: Digital signature



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