public:
RGWCORSRule() : max_age(CORS_MAX_AGE_INVALID),allowed_methods(0) {}
RGWCORSRule(std::set<string>& o, std::set<string>& h,
- std::list<string>& e, uint8_t f, unsigned a)
+ std::list<string>& e, uint8_t f, uint32_t a)
:max_age(a),
allowed_methods(f),
allowed_hdrs(h),
iter = find("MaxAgeSeconds");
if ((obj = iter.get_next())) {
char *end = NULL;
- max_age = strtoul(obj->get_data().c_str(), &end, 10);
- if (max_age == ULONG_MAX)
+
+ unsigned long ul = strtoul(obj->get_data().c_str(), &end, 10);
+ if (ul == ULONG_MAX || ul >= 0x100000000LL) {
max_age = CORS_MAX_AGE_INVALID;
+ } else {
+ max_age = (uint32_t)ul;
+ }
dout(10) << "RGWCORSRule : max_age : " << max_age << dendl;
}
/*Check and update ExposeHeader*/
const char *expose_headers, const char *max_age) {
set<string> o, h, oc;
list<string> e;
- unsigned a = CORS_MAX_AGE_INVALID;
+ unsigned long a = CORS_MAX_AGE_INVALID;
uint8_t flags = RGW_CORS_ALL;
string ao = allow_origins;