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 best solutions below

1
namus On

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