CertGetNameString throws heap corruption

119 views Asked by At

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)) {}

1

There are 1 answers

1
namus On

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