[dovecot-cvs] dovecot configure.in,1.68,1.69

cras at procontrol.fi cras at procontrol.fi
Tue Dec 3 03:37:00 EET 2002


Update of /home/cvs/dovecot
In directory danu:/tmp/cvs-serv18940

Modified Files:
	configure.in 
Log Message:
Give a hard warning if size_t is signed.



Index: configure.in
===================================================================
RCS file: /home/cvs/dovecot/configure.in,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- configure.in	3 Dec 2002 00:13:17 -0000	1.68
+++ configure.in	3 Dec 2002 01:36:58 -0000	1.69
@@ -333,6 +333,33 @@
 AC_DEFINE_UNQUOTED(OFF_T_MAX, $offt_max, Maximum value of off_t)
 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "$uofft_fmt", printf() format for uoff_t)
 
+dnl * make sure size_t isn't signed. we'd probably work fine with it, but
+dnl * it's more likely vulnerable to buffer overflows. Anyway, C99 specifies
+dnl * that it's unsigned and only some old systems define it as signed.
+AC_MSG_CHECKING([whether size_t is signed])
+AC_TRY_RUN([
+  #include <sys/types.h>
+  int main() {
+    /* return 0 if we're signed */
+    exit((size_t)(int)-1 <= 0 ? 0 : 1);
+  }
+], [
+  AC_MSG_RESULT(yes)
+
+  echo
+  echo "Your system's size_t is a signed integer, Dovecot isn't designed to"
+  echo "support it. It probably works just fine, but it's less resistant to"
+  echo "buffer overflows. If you're not worried about this and still want to"
+  echo "compile Dovecot, set ignore_signed_size=1 environment."
+
+  if test "$ignore_signed_size" = ""; then
+    AC_ERROR([aborting])
+  fi
+  echo "..ignoring as requested.."
+], [
+  AC_MSG_RESULT(no)
+])
+
 AC_TYPEOF(ssize_t)
 case "$typeof_ssize_t" in
   long)




More information about the dovecot-cvs mailing list