Subject: Bug#126622: uw-imap: Probable IA-64 segfault in mlock (fwd)

From: "Jaldhar H. Vyas" <[email-masked]>
Date: Thu, 27 Dec 2001 13:37:33 -0500 (EST)

Mark, I received the following report in the Debian bug tracking system
today and thought it might interest you.  It's a trivial fix.

-- 
Jaldhar H. Vyas <[email-masked]>
It's a girl! See the pictures - http://www.braincells.com/shailaja/

---------- Forwarded message ----------
Date: Thu, 27 Dec 2001 11:00:21 -0500
From: John R.Daily <[email-masked]>

I don't have a simple way to verify this, but the lack of a
malloc prototype in mlock.c will probably result in segfaults
on the IA-64 platform.

On the IA-64 platform, unprototyped functions that return pointers
may cause corrupted pointers and hence segfaults, because the C
compiler assumes that an undeclared function returns an integer,
and on the IA-64, pointers are twice as long as integers and use
the high-order bits that would be truncated.

Here is a patch for mlock.c. All that is required is inclusion of
the stdlib.h header.

--- uw-imap.orig/build-tree/imap-2001a/src/mlock/mlock.c	Thu Dec 27 10:56:54 2001
+++ uw-imap-2001adebian/build-tree/imap-2001a/src/mlock/mlock.c	Thu Dec 27 10:55:52 2001
@@ -43,6 +43,7 @@
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <stdlib.h>  /* malloc(3) */

 #define LOCKTIMEOUT 5		/* lock timeout in minutes */
 #define LOCKPROTECTION 0775

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------