Mercurial > dovecot > original-hg > dovecot-1.2
changeset 750:b97c8964d7c1 HEAD
Give a hard warning if size_t is signed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 03 Dec 2002 03:36:58 +0200 |
parents | 501bd2f532ae |
children | 04e2c5774c3f |
files | configure.in |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Tue Dec 03 02:59:10 2002 +0200 +++ b/configure.in Tue Dec 03 03:36:58 2002 +0200 @@ -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)