tokenCode = s->info.args.get("TokenCode");
if (! duration.empty()) {
- uint64_t duration_in_secs = stoull(duration);
+ string err;
+ uint64_t duration_in_secs = strict_strtoll(duration.c_str(), 10, &err);
+ if (!err.empty()) {
+ return -EINVAL;
+ }
+
if (duration_in_secs < STS::GetSessionTokenRequest::getMinDuration() ||
duration_in_secs > s->cct->_conf->rgw_sts_max_session_duration)
return -EINVAL;
if (duration.empty()) {
this->duration = DEFAULT_DURATION_IN_SECS;
} else {
- this->duration = std::stoull(duration);
+ this->duration = strict_strtoll(duration.c_str(), 10, &this->err_msg);
}
}
int AssumeRoleRequestBase::validate_input() const
{
+ if (!err_msg.empty()) {
+ return -EINVAL;
+ }
+
if (duration < MIN_DURATION_IN_SECS ||
duration > MAX_DURATION_IN_SECS) {
return -EINVAL;
static constexpr uint64_t MAX_ROLE_SESSION_SIZE = 64;
uint64_t MAX_DURATION_IN_SECS;
uint64_t duration;
+ string err_msg;
string iamPolicy;
string roleArn;
string roleSessionName;