char strings require an extra char for the NUL terminating
character, so add one more to the size a VB programmer would use, e.g.
char sDigest_sha1[41]; /* SHA-1 digest is 40 hex chars plus NUL */ char sDigest_sha2[65]; /* SHA-256 digest is 64 hex chars plus NUL */
or
#include <stdlib.h>
char *buf;
buf = malloc(PKI_MAX_HASH_CHARS + 1);
/* ... */
free(buf);
We recommend using the defined constants like PKI_MAX_SHA1_CHARS
and PKI_MAX_SHA1_BYTES rather than hard-coded numbers, e.g.
char sDigest_sha1[PKI_MAX_SHA1_CHARS + 1];
See the constants in diCrPKI.h.