[svn] GnuPG - r4812 - in branches/STABLE-BRANCH-1-4: . g10
svn author wk
cvs at cvs.gnupg.org
Mon Aug 11 10:19:51 CEST 2008
Author: wk
Date: 2008-08-11 10:19:48 +0200 (Mon, 11 Aug 2008)
New Revision: 4812
Modified:
branches/STABLE-BRANCH-1-4/ChangeLog
branches/STABLE-BRANCH-1-4/configure.ac
branches/STABLE-BRANCH-1-4/g10/ChangeLog
branches/STABLE-BRANCH-1-4/g10/keygen.c
Log:
Fix bug #947 (expire time overflow)
Modified: branches/STABLE-BRANCH-1-4/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/ChangeLog 2008-08-11 08:08:08 UTC (rev 4811)
+++ branches/STABLE-BRANCH-1-4/ChangeLog 2008-08-11 08:19:48 UTC (rev 4812)
@@ -1,3 +1,7 @@
+2008-08-11 Werner Koch <wk at g10code.com>
+
+ * configure.ac: Check for size of time_t.
+
2008-04-01 Werner Koch <wk at g10code.com>
* configure.ac (AC_INIT): Fix quoting.
Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-08-11 08:08:08 UTC (rev 4811)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-08-11 08:19:48 UTC (rev 4812)
@@ -1,3 +1,8 @@
+2008-08-11 Werner Koch <wk at g10code.com>
+
+ * keygen.c (ask_expire_interval): Check for time overflow of an
+ u32. Fixes bug #947. Use SIZEOF_TIME_T for the 2039--2106 check.
+
2008-08-01 Werner Koch <wk at g10code.com>
* tdbio.c (open_db) [!EROFS]: Move closing parens out of the
Modified: branches/STABLE-BRANCH-1-4/configure.ac
===================================================================
--- branches/STABLE-BRANCH-1-4/configure.ac 2008-08-11 08:08:08 UTC (rev 4811)
+++ branches/STABLE-BRANCH-1-4/configure.ac 2008-08-11 08:19:48 UTC (rev 4812)
@@ -949,6 +949,19 @@
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
+AC_CHECK_SIZEOF(time_t,,[[
+#include <stdio.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+]])
# Ensure that we have UINT64_C before we bother to check for uint64_t
AC_CHECK_HEADERS([inttypes.h])
Modified: branches/STABLE-BRANCH-1-4/g10/keygen.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keygen.c 2008-08-11 08:08:08 UTC (rev 4811)
+++ branches/STABLE-BRANCH-1-4/g10/keygen.c 2008-08-11 08:19:48 UTC (rev 4812)
@@ -1697,12 +1697,18 @@
? _("Key expires at %s\n")
: _("Signature expires at %s\n"),
asctimestamp((ulong)(timestamp + interval) ) );
- /* FIXME: This check yields warning on alhas: Write a
- configure check and to this check here only for 32 bit
- machines */
- if( (time_t)((ulong)(timestamp+interval)) < 0 )
- tty_printf(_("Your system can't display dates beyond 2038.\n"
- "However, it will be correctly handled up to 2106.\n"));
+#if SIZEOF_TIME_T <= 4
+ if ((time_t)((ulong)(timestamp+interval)) < 0 )
+ tty_printf (_("Your system can't display dates beyond 2038.\n"
+ "However, it will be correctly handled up to"
+ " 2106.\n"));
+ else
+#endif /*SIZEOF_TIME_T*/
+ if ( (time_t)((unsigned long)(timestamp+interval)) < timestamp )
+ {
+ tty_printf (_("invalid value\n"));
+ continue;
+ }
}
if( cpr_enabled() || cpr_get_answer_is_yes("keygen.valid.okay",
More information about the Gnupg-commits
mailing list