ACLCertificateData::ACLCertificateData(Ssl::GETX509ATTRIBUTE *sslStrategy, const char *attrs, bool optionalAttr) : validAttributesStr(attrs), attributeIsOptional(optionalAttr), attribute (NULL), values (), sslAttributeCall (sslStrategy)
{
if (attrs) {
- size_t current;
- size_t next = -1;
+ size_t current = 0;
+ size_t next = std::string::npos;
std::string valid(attrs);
do {
- current = next + 1;
next = valid.find_first_of( "|", current);
- validAttributes.push_back(valid.substr( current, next - current ));
+ validAttributes.push_back(valid.substr( current, (next == std::string::npos ? std::string::npos : next - current)));
+ current = next + 1;
} while (next != std::string::npos);
}
}