From: Simon Josefsson Date: Fri, 10 Sep 2010 07:36:20 +0000 (+0000) Subject: Fix crash on Mac OS X. X-Git-Tag: yubikey-personalisation_1.3.5-1~4^2~15 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89106f9296ddb4c15bdbc6394d46dafaf2e7eefd;p=yubikey-personalization.old Fix crash on Mac OS X. Reported by rosmiitto in Issue #6: . --- diff --git a/NEWS b/NEWS index 27a4090..d698c5a 100644 --- 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: +. + ** Fix bug that prevented salting during AES key generation ** from passwords from working. Reported by Ben. diff --git a/ykcore/ykcore_osx.c b/ykcore/ykcore_osx.c index ab5ec37..0ab2f78 100644 --- a/ykcore/ykcore_osx.c +++ b/ykcore/ykcore_osx.c @@ -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,