dkim_get_policy() doesn't check the return codes from dkim_get_policy_dns() and dkim_get_policy_file().
If an error is returned from one of those functions, it's possible that neither 'buf' nor 'qstat' have been changed. qstat is inited to NOERROR at the beginning of dkim_get_policy() which causes this block of code to exectued:
2030 if (qstat == NOERROR)
2031 {
2032 char *p;
2033 struct dkim_set *set;
2034
2035 pstatus = dkim_process_set(dkim, DKIM_SETTYPE_POLICY,
2036 buf, strlen(buf), NULL);
As mentioned above, 'buf' is uninitialized if there was an error in dkim_get_policy_dns(), etc..
Logged In: YES
user_id=1048957
Originator: NO
Try the attached patch.
File Added: PATCH
Proposed patch #1
Logged In: YES
user_id=1048957
Originator: NO
v2.4.0 released, containing this patch.