Fix length return for SCARD_ATTR_VENDOR_NAME
@@ -2456,6 +2456,8 @@ static LONG WINAPI PCSC_SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE
if (status == SCARD_S_SUCCESS)
{
if (dwAttrId == SCARD_ATTR_VENDOR_NAME)
+ {
+ if (pbAttr)
{
const char* vendorName;
@@ -2470,11 +2472,12 @@ static LONG WINAPI PCSC_SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE
vendorName = (char*)pbAttr;
if (vendorName)
- *pcbAttrLen = strlen(vendorName);
+ *pcbAttrLen = strnlen(vendorName, *pcbAttrLen);
else
*pcbAttrLen = 0;
}
}
+ }
else
{
