[Pcsclite-git-commit] [PCSC] 01/03: hotplug_libudev.c: Fix asprintf(3) use

Ludovic Rousseau rousseau at moszumanska.debian.org
Wed Nov 18 16:06:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit acb04f9ca3e20bde5290cd81f5091ca30b3e97db
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Wed Nov 18 16:53:08 2015 +0100

    hotplug_libudev.c: Fix asprintf(3) use
    
    The value returned by asprintf() is stored in i but i is also later used
    as the readerTracker[] index.
    
    The code was then completely broken. The code now uses a different
    variable.
---
 src/hotplug_libudev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/hotplug_libudev.c b/src/hotplug_libudev.c
index d79c52e..8347f08 100644
--- a/src/hotplug_libudev.c
+++ b/src/hotplug_libudev.c
@@ -375,7 +375,7 @@ static void HPRemoveDevice(struct udev_device *dev)
 
 static void HPAddDevice(struct udev_device *dev)
 {
-	int i;
+	int i, a;
 	char *deviceName = NULL;
 	char *fullname = NULL;
 	struct _driverTracker *driver, *classdriver;
@@ -438,9 +438,9 @@ static void HPAddDevice(struct udev_device *dev)
 	else
 		bInterfaceNumber = 0;
 
-	i = asprintf(&deviceName, "usb:%04x/%04x:libudev:%d:%s",
+	a = asprintf(&deviceName, "usb:%04x/%04x:libudev:%d:%s",
 		driver->manuID, driver->productID, bInterfaceNumber, devpath);
-	if (-1 ==  i)
+	if (-1 ==  a)
 	{
 		Log1(PCSC_LOG_ERROR, "asprintf() failed");
 		return;
@@ -475,8 +475,8 @@ static void HPAddDevice(struct udev_device *dev)
 		char *result;
 
 		/* create a new name */
-		i= asprintf(&result, "%s [%s]", fullname, sInterfaceName);
-		if (-1 ==  i)
+		a = asprintf(&result, "%s [%s]", fullname, sInterfaceName);
+		if (-1 ==  a)
 		{
 			Log1(PCSC_LOG_ERROR, "asprintf() failed");
 			goto exit;
@@ -496,8 +496,8 @@ static void HPAddDevice(struct udev_device *dev)
 			char *result;
 
 			/* create a new name */
-			i = asprintf(&result, "%s (%s)", fullname, sSerialNumber);
-			if (-1 ==  i)
+			a = asprintf(&result, "%s (%s)", fullname, sSerialNumber);
+			if (-1 ==  a)
 			{
 				Log1(PCSC_LOG_ERROR, "asprintf() failed");
 				goto exit;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list