namus
namus

Reputation: 79

CertGetNameString throws heap corruption

CertGetNameString() throws heap corruption error randomly, using the function CertGetNameStringW() does the same

LPCWSTR pszName = (LPCWSTR)malloc(cbSize * sizeof(TCHAR));
if (CertGetNameString( pCurrentCertContext, dwType, dwFlags, nullptr, pszName, cbSize)) {}

Upvotes: 0

Views: 185

Answers (1)

namus
namus

Reputation: 79

The code which involves usage of CertGetNameString() cyrpt api requires the code be built using preprocessor directive UNICODE enabled.

Upvotes: 0

Related Questions