Commit 8f76cc68 authored by Torge Matthies's avatar Torge Matthies Committed by Alexandre Julliard

wintrust: Decode a zero-length OID to an empty string.

parent c58c42ad
...@@ -1878,6 +1878,8 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType, ...@@ -1878,6 +1878,8 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
} }
} }
} }
else
bytesNeeded += 1;
if (!pvStructInfo) if (!pvStructInfo)
*pcbStructInfo = bytesNeeded; *pcbStructInfo = bytesNeeded;
else if (*pcbStructInfo < bytesNeeded) else if (*pcbStructInfo < bytesNeeded)
...@@ -1888,12 +1890,13 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType, ...@@ -1888,12 +1890,13 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
} }
else else
{ {
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
*pszObjId = 0;
if (dataLen) if (dataLen)
{ {
const BYTE *ptr; const BYTE *ptr;
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
*pszObjId = 0;
pszObjId += sprintf(pszObjId, "%d.%d", pbEncoded[1 + lenBytes] / 40, pszObjId += sprintf(pszObjId, "%d.%d", pbEncoded[1 + lenBytes] / 40,
pbEncoded[1 + lenBytes] - (pbEncoded[1 + lenBytes] / pbEncoded[1 + lenBytes] - (pbEncoded[1 + lenBytes] /
40) * 40); 40) * 40);
...@@ -1914,8 +1917,6 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType, ...@@ -1914,8 +1917,6 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
pszObjId += sprintf(pszObjId, ".%d", val); pszObjId += sprintf(pszObjId, ".%d", val);
} }
} }
else
*(LPSTR *)pvStructInfo = NULL;
*pcbStructInfo = bytesNeeded; *pcbStructInfo = bytesNeeded;
} }
} }
......
...@@ -682,13 +682,11 @@ static void test_decodeSPCIndirectDataContent(void) ...@@ -682,13 +682,11 @@ static void test_decodeSPCIndirectDataContent(void)
if (ret) if (ret)
{ {
indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf; indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf;
todo_wine
ok(indirectData->Data.pszObjId != NULL, "Expected non-NULL data objid\n"); ok(indirectData->Data.pszObjId != NULL, "Expected non-NULL data objid\n");
if (indirectData->Data.pszObjId) if (indirectData->Data.pszObjId)
ok(!strcmp(indirectData->Data.pszObjId, ""), ok(!strcmp(indirectData->Data.pszObjId, ""),
"Expected empty data objid\n"); "Expected empty data objid\n");
ok(indirectData->Data.Value.cbData == 0, "Expected no data value\n"); ok(indirectData->Data.Value.cbData == 0, "Expected no data value\n");
todo_wine
ok(indirectData->DigestAlgorithm.pszObjId != NULL, ok(indirectData->DigestAlgorithm.pszObjId != NULL,
"Expected non-NULL digest algorithm objid\n"); "Expected non-NULL digest algorithm objid\n");
if (indirectData->DigestAlgorithm.pszObjId) if (indirectData->DigestAlgorithm.pszObjId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment