diff options
author | Ingo Klöcker <[email protected]> | 2025-05-05 14:14:55 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2025-05-05 14:14:55 +0000 |
commit | f23cef6f66a44c5c1cc8717f74b658d14fde04e5 (patch) | |
tree | 218f0fc78bccbd3878800accfb1a653b28c07860 /lang/cpp/src/key.cpp | |
parent | cpp: Add missing transition, remove two ignored (and wrong) transitions (diff) | |
download | gpgme-f23cef6f66a44c5c1cc8717f74b658d14fde04e5.tar.gz gpgme-f23cef6f66a44c5c1cc8717f74b658d14fde04e5.zip |
cpp: Ensure correct expiration time on 32-bit arch with 64-bit time_tgpgme-1.24-branch
* lang/cpp/src/key.cpp (Subkey::expirationTime): Cast away the
signedness of _gpgme_subkey.expires before casting to time_t.
--
_gpgme_subkey.expires stores the expiration as `long int` although the
expiration is always an unsigned value. Casting the value to unsigned
long int before casting it to time_t ensures that we get the correct
expiration value for 64-bit time_t even on 32-bit systems. With signed
32-bit time_t we still get a negative value as before.
GnuPG-bug-id: 7627
Diffstat (limited to '')
-rw-r--r-- | lang/cpp/src/key.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index 42046aa0..2b14d901 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -633,7 +633,7 @@ time_t Subkey::creationTime() const time_t Subkey::expirationTime() const { - return static_cast<time_t>(subkey ? subkey->expires : 0); + return static_cast<time_t>(static_cast<unsigned long int>(subkey ? subkey->expires : 0)); } bool Subkey::neverExpires() const |