[cpp-opensaml] branch master updated: CPPXT-121 Fix potential signed overflow
Rod Widdowson
rdw at steadingsoftware.com
Tue Aug 15 12:33:56 EDT 2017
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository cpp-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-opensaml.git;a=commit;h=41f767a9508e1752af2cb8beb42b1565d4365fa1
The following commit(s) were added to refs/heads/master by this push:
new 41f767a CPPXT-121 Fix potential signed overflow
41f767a is described below
commit 41f767a9508e1752af2cb8beb42b1565d4365fa1
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Aug 15 17:32:38 2017 +0100
CPPXT-121 Fix potential signed overflow
https://issues.shibboleth.net/jira/browse/CPPXT-121
---
saml/saml2/metadata/impl/DynamicMetadataProvider.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
index 86631bb..7ca8d6e 100644
--- a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
+++ b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
@@ -50,9 +50,14 @@ using namespace xmltooling::logging;
using namespace xmltooling;
using namespace std;
+#include <limits>
+
# ifndef min
# define min(a,b) (((a) < (b)) ? (a) : (b))
# endif
+# ifdef max
+# undef max
+# endif
static const XMLCh id[] = UNICODE_LITERAL_2(i,d);
static const XMLCh cleanupInterval[] = UNICODE_LITERAL_15(c,l,e,a,n,u,p,I,n,t,e,r,v,a,l);
@@ -301,7 +306,10 @@ pair<const EntityDescriptor*,const RoleDescriptor*> DynamicMetadataProvider::get
doFilters(*entity2);
time_t now = time(nullptr);
- if (entity2->getValidUntil() && entity2->getValidUntilEpoch() < now + 60)
+ time_t cmp = now;
+ if (cmp < (std::numeric_limits<int>::max() - 60))
+ cmp += 60;
+ if (entity2->getValidUntil() && entity2->getValidUntilEpoch() < cmp)
throw MetadataException("Metadata was already invalid at the time of retrieval.");
log.info("caching resolved metadata for (%s)", name.c_str());
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list