Safer usage of libudev functions

This commit is contained in:
Nikos Mavrogiannopoulos 2014-06-03 09:57:05 +02:00
parent 5d49035ba2
commit 7ca80f4d98
2 changed files with 34 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: pcsc-lite
Version: 1.8.10
Release: 3%{?dist}
Release: 4%{?dist}
Summary: PC/SC Lite smart card framework and applications
Group: System Environment/Daemons
@ -12,6 +12,7 @@ Source0: https://alioth.debian.org/frs/download.php/file/%{upstream_build
Source1: org.debian.pcsc-lite.policy
Patch0: pcscd-1.8.10-polkit.patch
Patch1: pcscd-1.8.10-null-force.patch
Patch2: pcscd-1.8.10-safer-udev-usage.patch
BuildRequires: doxygen
BuildRequires: graphviz
@ -68,6 +69,7 @@ Requires: %{name}-libs = %{version}-%{release}
%patch0 -p1 -b .polkit
%patch1 -p1 -b .null
%patch2 -p1 -b .udev
# Convert to utf-8
for file in ChangeLog; do
@ -150,6 +152,9 @@ rm $RPM_BUILD_ROOT%{_docdir}/pcsc-lite/README.DAEMON
%changelog
* Tue Jun 03 2014 Nikos Mavrogiannopoulos <nmav@redhat.com> - 1.8.10-4
- Safer usage of libudev functions
* Tue Mar 11 2014 Nikos Mavrogiannopoulos <nmav@redhat.com> - 1.8.10-3
- The default installed polkit policy allows console users to access
smart cards. Non-interactive or remote usage now requires admin

View File

@ -0,0 +1,28 @@
diff -ur pcsc-lite-1.8.10.orig/src/hotplug_libudev.c pcsc-lite-1.8.10/src/hotplug_libudev.c
--- pcsc-lite-1.8.10.orig/src/hotplug_libudev.c 2013-10-06 12:25:18.000000000 +0200
+++ pcsc-lite-1.8.10/src/hotplug_libudev.c 2014-06-03 09:54:44.289011617 +0200
@@ -541,6 +541,12 @@
fd_set fds;
udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
+ if (udev_monitor == NULL)
+ {
+ Log1(PCSC_LOG_ERROR, "udev_monitor_new_from_netlink() error\n");
+ return;
+ }
+
/* filter only the interfaces */
r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb",
@@ -560,6 +566,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\n", fd);
+ return;
+ }
while (!AraKiriHotPlug)
{