Skip to content

Commit 58fe6bc

Browse files
committed
prevent duplicate lookup when searching for verification algorithm
1 parent a631f06 commit 58fe6bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/jwt-cpp/jwt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3801,11 +3801,12 @@ namespace jwt {
38013801
}
38023802

38033803
if (!key_found) {
3804-
if (algs.count(algo) == 0) {
3804+
auto alg = algs.find(algo);
3805+
if (alg == algs.end()) {
38053806
ec = error::token_verification_error::wrong_algorithm;
38063807
return;
38073808
}
3808-
algs.at(algo)->verify(data, sig, ec);
3809+
alg->second->verify(data, sig, ec);
38093810
}
38103811

38113812
if (ec) return;

0 commit comments

Comments
 (0)