http://bugs.winehq.org/show_bug.cgi?id=28857
--- Comment #19 from Charles Davis cdavis@mymail.mines.edu 2011-10-23 16:52:00 CDT --- That's useful to know. When I compiled my test program as 32-bit, it stepped beyond the end in the same way Wine does now. And I think I know why.
On 64-bit FreeBSD, a struct xinpgen is 32 bytes long. But in 32-bit FreeBSD, a struct xinpgen is only 16 bytes long. Because the kernel is LP64, it is returning 32-byte xinpgen structures, which is bigger than the 16 bytes the loop was expecting. Because of this, the loop does not terminate like it should.
Unfortunately, I don't know how to fix this yet. Juan, any ideas?