From: Nikos Mavrogiannopoulos Date: Sat, 17 Mar 2012 12:25:50 +0000 (+0100) Subject: Applied patch to cast days to (time_t) before converting it to X-Git-Tag: gnutls_3_0_18~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b89083385bc30c2dce2516a5c98e544fb6eadc9b;p=thirdparty%2Fgnutls.git Applied patch to cast days to (time_t) before converting it to seconds to prevent a Y2K38 bug. Patch by Robert Millan. --- diff --git a/NEWS b/NEWS index 490660d86e..e212072c1e 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,15 @@ GnuTLS NEWS -- History of user-visible changes. -*- outline -*- Copyright (C) 2000-2012 Free Software Foundation, Inc. See the end for copying conditions. +* Version 3.0.18 (unreleased) + +** certtool: Avoid a Y2K38 bug when generating certificates. +Patch by Robert Millan. + +** API and ABI modifications: +No changes since last version. + + * Version 3.0.17 (released 2012-03-17) ** command line apps: Always link with local libopts. diff --git a/src/certtool.c b/src/certtool.c index df2303304f..0c4ed9aa18 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -417,7 +417,7 @@ generate_certificate (gnutls_privkey_t * ret_key, result = gnutls_x509_crt_set_expiration_time (crt, - time (NULL) + days * 24 * 60 * 60); + time (NULL) + ((time_t) days) * 24 * 60 * 60); if (result < 0) error (EXIT_FAILURE, 0, "set_expiration: %s", gnutls_strerror (result)); @@ -933,7 +933,7 @@ update_signed_certificate (common_info_st * cinfo) days = get_days (); result = - gnutls_x509_crt_set_expiration_time (crt, tim + days * 24 * 60 * 60); + gnutls_x509_crt_set_expiration_time (crt, tim + ((time_t) days) * 24 * 60 * 60); if (result < 0) error (EXIT_FAILURE, 0, "set_expiration: %s", gnutls_strerror (result));