1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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

Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
This commit is contained in:
Torge Matthies 2023-08-07 11:04:34 +02:00 committed by Alexandre Julliard
parent c58c42ad93
commit 8f76cc687d
2 changed files with 5 additions and 6 deletions

View file

@ -1878,6 +1878,8 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
}
}
}
else
bytesNeeded += 1;
if (!pvStructInfo)
*pcbStructInfo = bytesNeeded;
else if (*pcbStructInfo < bytesNeeded)
@ -1888,12 +1890,13 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
}
else
{
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
*pszObjId = 0;
if (dataLen)
{
const BYTE *ptr;
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
*pszObjId = 0;
pszObjId += sprintf(pszObjId, "%d.%d", pbEncoded[1 + lenBytes] / 40,
pbEncoded[1 + lenBytes] - (pbEncoded[1 + lenBytes] /
40) * 40);
@ -1914,8 +1917,6 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
pszObjId += sprintf(pszObjId, ".%d", val);
}
}
else
*(LPSTR *)pvStructInfo = NULL;
*pcbStructInfo = bytesNeeded;
}
}

View file

@ -682,13 +682,11 @@ static void test_decodeSPCIndirectDataContent(void)
if (ret)
{
indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf;
todo_wine
ok(indirectData->Data.pszObjId != NULL, "Expected non-NULL data objid\n");
if (indirectData->Data.pszObjId)
ok(!strcmp(indirectData->Data.pszObjId, ""),
"Expected empty data objid\n");
ok(indirectData->Data.Value.cbData == 0, "Expected no data value\n");
todo_wine
ok(indirectData->DigestAlgorithm.pszObjId != NULL,
"Expected non-NULL digest algorithm objid\n");
if (indirectData->DigestAlgorithm.pszObjId)