From: simon75j 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~5^2~15 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e974d4936024e10304742e18a46f4ad6a6599eef;p=yubikey-personalization Fix crash on Mac OS X. Reported by rosmiitto in Issue #6: . git-svn-id: https://yubikey-personalization.googlecode.com/svn/trunk@260 b62f149e-849f-11dd-9899-c7ba65f7c4c7 --- 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,