On NetBSD/alpha (which is LP64), and I believe on any other platform on which long is longer than int, parsing of rfc822 address headers fails. This is because the computation overflows in this libdkim/rfc2822.c line:
#define CMAP_BIT(i) (1 << (unsigned char)(i) % CMAP_NBITS)
The literal 1 is of type int, and CMAP_NBITS is the number of bits in cmap_elem_type, which is unsigned long. So, when you shift the int 1 more than the number of bits in an int, you shift them right out the left side.
The solution is easy; change "1" to "1L" to explicitly make 1 a long to match cmap_elem_type. A patch is attached.
It looks like this bug has been present from at least 0.1.1 all the way through the current 2.4.2.
Log in to post a comment.