]> err.no Git - yubikey-personalization.old/commitdiff
Fix crash on Mac OS X.
authorSimon Josefsson <simon@josefsson.org>
Fri, 10 Sep 2010 07:36:20 +0000 (07:36 +0000)
committerSimon Josefsson <simon@josefsson.org>
Fri, 10 Sep 2010 07:36:20 +0000 (07:36 +0000)
Reported by rosmiitto in Issue #6:
<http://code.google.com/p/yubikey-personalization/issues/detail?id=6>.

NEWS
ykcore/ykcore_osx.c

diff --git a/NEWS b/NEWS
index 27a4090f03e769ba8e08d4559c061c99b882c872..d698c5a30e0d37962d62add1ceeae02667234aae 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ Yubikey-personalize NEWS -- History of user-visible changes.     -*- outline -*-
 
 * Version 1.3.4 (unreleased)
 
+** Fix crash on Mac OS X.
+Reported by rosmiitto in Issue #6:
+<http://code.google.com/p/yubikey-personalization/issues/detail?id=6>.
+
 ** Fix bug that prevented salting during AES key generation
 ** from passwords from working.  Reported by Ben.
 
index ab5ec372fa01962f14aa7eec5ccd78b72dcdbc68..0ab2f78ab358ad6e2e2de94f9dd4e7769c89dc41 100644 (file)
@@ -142,21 +142,23 @@ int _ykusb_close_device(void *dev)
 int _ykusb_read(void *dev, int report_type, int report_number,
                char *buffer, int size)
 {
+       CFIndex sizecf = (CFIndex)size;
+
        if (report_type != REPORT_TYPE_FEATURE)
        {
                yk_errno = YK_ENOTYETIMPL;
                return 0;
        }
        
-       _ykusb_IOReturn = IOHIDDeviceGetReport( dev, kIOHIDReportTypeFeature, report_number, (uint8_t *)buffer, (CFIndex *) &size );
+       _ykusb_IOReturn = IOHIDDeviceGetReport( dev, kIOHIDReportTypeFeature, report_number, (uint8_t *)buffer, (CFIndex *) &sizecf );
        
        if ( _ykusb_IOReturn != kIOReturnSuccess )
        {
                yk_errno = YK_EUSBERR;
                return 0;
        }
-       
-       return size;
+
+       return (int)sizecf;
 }
 
 int _ykusb_write(void *dev, int report_type, int report_number,