Openssl ERR_error_string error description returns null

err_data is an unitialized pointer. According to the documentation, "buf must be at least 256 bytes long."

So try:

for (unsigned long int er_code = 0; er_code < 100; er_code++)
{
    char err_data[256];
    ERR_error_string(er_code, err_data);
    printf("error code: %lu data: %s\n", er_code, err_data);
}

Or, "If buf is NULL, the error string is placed in a static buffer." So you could also do:

for (unsigned long int er_code = 0; er_code < 100; er_code++)
{
    char* err_data = ERR_error_string(er_code, NULL);
    printf("error code: %lu data: %s\n", er_code, err_data);
}