mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
Fix out-of-bounds access in three_parts. Fix mishandling of non-null terminated string_views in jwt_set::case_compare. Address several conversion and unreachability warnings
This commit is contained in:
parent
0d662241da
commit
6c22d941a0
6 changed files with 11 additions and 33 deletions
|
@ -72,7 +72,6 @@ inline enum type str_to_type(const jwt::string_view typ) noexcept
|
|||
else if(!strcasecmp(typ.data(), "none")) return type::NONE;
|
||||
|
||||
JWT_NOT_REACHED("Code not reached");
|
||||
return type::NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,7 +129,6 @@ inline jwt::string_view reg_claims_to_str(SCOPED_ENUM registered_claims claim) n
|
|||
default: assert (0 && "Not a registered claim");
|
||||
};
|
||||
JWT_NOT_REACHED("Code not reached");
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,27 +145,9 @@ struct jwt_set
|
|||
{
|
||||
using is_transparent = std::true_type;
|
||||
|
||||
bool operator()(const std::string& lhs, const std::string& rhs) const
|
||||
{
|
||||
int ret = strcmp(lhs.c_str(), rhs.c_str());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const jwt::string_view lhs, const jwt::string_view rhs) const
|
||||
{
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const std::string& lhs, const jwt::string_view rhs) const
|
||||
{
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const jwt::string_view lhs, const std::string& rhs) const
|
||||
{
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
int ret = lhs.compare(rhs);
|
||||
return (ret < 0);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue