Hi,

About a year ago I inhereted a mail system where the previous admin had died.
It runs dspam and has been doing so successfully.  Today spamd died on signal
8 and restarting it would kill it again.  A newly compiled version of dspam
also died on signal 8.  So I put debugging symbols to on and debugged where
the daemon was dying.  I came up with a workaround where the condition where
the divide by zero happens but I'm unsure if it's the RIGHT fix or not, 
temporarely it seemed to have worked.  On line 1194 in hash_drv.c is the
following:

-----
  if (offset >= map->file_len)
    return 0;

        if (header->hash_rec_max == 0)          /* don't signal 8 */
                return 0;

  fpos = sizeof(struct _hash_drv_header) + 
    ((hashcode % header->hash_rec_max) * sizeof(struct _hash_drv_spam_record));
----

I put in the check with the comment of "don't signal 8".  The value of
header->hash_rec_max is 0 and because you are MOD'ing (which is the remainder
of a divide) the kernel throws a signal at the program.

I'm totally unsure whether this is the right fix or not and I'm wondering
whether a (return -1) is better here.  For now it seems to have caused no
endless loops returning with 0, but please, you know the code best let me
know what is the best solution.

This bug has been around since 2007 I found this with google:

http://www.mail-archive.com/dspam-dev@lists.nuclearelephant.com/msg00130.html

Best Regards,

-peter

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to