[Pcsclite-cvs-commit] r6911 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Thu Jun 5 09:34:15 UTC 2014


Author: rousseau
Date: 2014-06-05 09:34:15 +0000 (Thu, 05 Jun 2014)
New Revision: 6911

Modified:
   trunk/PCSC/src/hotplug_libudev.c
Log:
Check udev functions for errors

Prevent the crash reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1071243

Thanks to Nikos Mavrogiannopoulos for the patch
http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20140602/000039.html


Modified: trunk/PCSC/src/hotplug_libudev.c
===================================================================
--- trunk/PCSC/src/hotplug_libudev.c	2014-06-04 13:16:24 UTC (rev 6910)
+++ trunk/PCSC/src/hotplug_libudev.c	2014-06-05 09:34:15 UTC (rev 6911)
@@ -567,6 +567,11 @@
 	fd_set fds;
 
 	udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
+	if (NULL == udev_monitor)
+	{
+		Log1(PCSC_LOG_ERROR, "udev_monitor_new_from_netlink() error");
+		return;
+	}
 
 	/* filter only the interfaces */
 	r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb",
@@ -586,6 +591,11 @@
 
 	/* udev monitor file descriptor */
 	fd = udev_monitor_get_fd(udev_monitor);
+	if (fd < 0)
+	{
+		Log2(PCSC_LOG_ERROR, "udev_monitor_get_fd() error: %d", fd);
+		return;
+	}
 
 	while (!AraKiriHotPlug)
 	{




More information about the Pcsclite-cvs-commit mailing list