Fix SCARD_AUTOALLOCATE handling
SCARD_AUTOALLOCATE is a define with value -1, which is compared to an uint32. There was some missassumtion of whenever its -1 or 0xffffffff through the code.
This commit is contained in:
parent
af08994cfd
commit
8c83f8957b
15
scard.c
15
scard.c
@ -2028,19 +2028,14 @@ TS_SCardGetAttrib(STREAM in, STREAM out)
|
||||
"TS_SCardGetAttrib(), hcard: 0x%08x [0x%08lx], attrib: 0x%08x (%d bytes)",
|
||||
(unsigned) hCard, (unsigned long) myHCard, (unsigned) dwAttrId, (int) dwAttrLen);
|
||||
|
||||
pbAttr = NULL;
|
||||
if (dwAttrLen != (SERVER_DWORD)SCARD_AUTOALLOCATE)
|
||||
{
|
||||
if (dwAttrLen > MAX_BUFFER_SIZE)
|
||||
{
|
||||
dwAttrLen = MAX_BUFFER_SIZE;
|
||||
|
||||
|
||||
if (dwAttrLen > SCARD_AUTOALLOCATE)
|
||||
pbAttr = NULL;
|
||||
else if ((dwAttrLen < 0) || (dwAttrLen > SCARD_MAX_MEM))
|
||||
{
|
||||
dwAttrLen = (SERVER_DWORD) SCARD_AUTOALLOCATE;
|
||||
pbAttr = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
pbAttr = SC_xmalloc(&lcHandle, dwAttrLen);
|
||||
if (!pbAttr)
|
||||
return SC_returnNoMemoryError(&lcHandle, in, out);
|
||||
|
Loading…
Reference in New Issue
Block a user