Commit 6099adf7 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wintrust: Return error directly from SOFTPUB_DecodeInnerContent.

parent 8085ea5f
...@@ -216,56 +216,70 @@ static DWORD SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data) ...@@ -216,56 +216,70 @@ static DWORD SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data)
static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data) static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
{ {
BOOL ret; BOOL ret;
DWORD size; DWORD size, err = ERROR_SUCCESS;
LPSTR oid = NULL; LPSTR oid = NULL;
LPBYTE buf = NULL; LPBYTE buf = NULL;
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL, ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL,
&size); &size);
if (!ret) if (!ret)
{
err = GetLastError();
goto error; goto error;
}
oid = data->psPfns->pfnAlloc(size); oid = data->psPfns->pfnAlloc(size);
if (!oid) if (!oid)
{ {
SetLastError(ERROR_OUTOFMEMORY); err = ERROR_OUTOFMEMORY;
ret = FALSE;
goto error; goto error;
} }
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid, ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid,
&size); &size);
if (!ret) if (!ret)
{
err = GetLastError();
goto error; goto error;
}
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size); ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size);
if (!ret) if (!ret)
{
err = GetLastError();
goto error; goto error;
}
buf = data->psPfns->pfnAlloc(size); buf = data->psPfns->pfnAlloc(size);
if (!buf) if (!buf)
{ {
SetLastError(ERROR_OUTOFMEMORY); err = ERROR_OUTOFMEMORY;
ret = FALSE;
goto error; goto error;
} }
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size); ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size);
if (!ret) if (!ret)
{
err = GetLastError();
goto error; goto error;
}
ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, NULL, &size); ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, NULL, &size);
if (!ret) if (!ret)
{
err = GetLastError();
goto error; goto error;
}
data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size); data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
if (!data->u.pPDSip->psIndirectData) if (!data->u.pPDSip->psIndirectData)
{ {
SetLastError(ERROR_OUTOFMEMORY); err = ERROR_OUTOFMEMORY;
ret = FALSE;
goto error; goto error;
} }
ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0,
data->u.pPDSip->psIndirectData, &size); data->u.pPDSip->psIndirectData, &size);
if (!ret)
err = GetLastError();
error: error:
TRACE("returning %d\n", ret); TRACE("returning %d\n", err);
data->psPfns->pfnFree(oid); data->psPfns->pfnFree(oid);
data->psPfns->pfnFree(buf); data->psPfns->pfnFree(buf);
return ret; return err;
} }
static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
...@@ -347,8 +361,8 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data) ...@@ -347,8 +361,8 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
err = SOFTPUB_CreateStoreFromMessage(data); err = SOFTPUB_CreateStoreFromMessage(data);
if (err) if (err)
goto error; goto error;
if (!SOFTPUB_DecodeInnerContent(data)) err = SOFTPUB_DecodeInnerContent(data);
err = GetLastError();
error: error:
return err; return err;
} }
...@@ -385,8 +399,7 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data) ...@@ -385,8 +399,7 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
err = SOFTPUB_CreateStoreFromMessage(data); err = SOFTPUB_CreateStoreFromMessage(data);
if (err) if (err)
goto error; goto error;
if (!SOFTPUB_DecodeInnerContent(data)) err = SOFTPUB_DecodeInnerContent(data);
err = GetLastError();
/* FIXME: this loads the catalog file, but doesn't validate the member. */ /* FIXME: this loads the catalog file, but doesn't validate the member. */
error: error:
CloseHandle(catalog); CloseHandle(catalog);
......
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