fix the wrong index issue in AuthProxy operator
details:
the caller want to scan both hw_enforced and sw_enforced list, however
the original check of the pos index has issue which will lost the sw_enforced.
Change-Id: I6e7abc1d0c6d20d7cad3b40aa73b18d2610f577b
diff --git a/include/keymaster/authorization_set.h b/include/keymaster/authorization_set.h
index fec3d46..30b978f 100644
--- a/include/keymaster/authorization_set.h
+++ b/include/keymaster/authorization_set.h
@@ -711,7 +711,9 @@
keymaster_key_param_t operator[](size_t pos) const {
if (pos < hw_enforced_.size()) return hw_enforced_[pos];
- if (pos < sw_enforced_.size()) return sw_enforced_[pos - hw_enforced_.size()];
+ if ((pos - hw_enforced_.size()) < sw_enforced_.size()) {
+ return sw_enforced_[pos - hw_enforced_.size()];
+ }
return {};
}