summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2016-07-20 16:59:06 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-20 16:59:06 +0000
commitdeab674fa9191e4028df00532502b29f0aedba05 (patch)
tree0e3202a3330c11b26075ee555149a7c549c4441e /service
parent6da17ca8f26560a6718626ca58a0c5693ace3f67 (diff)
parent2d032599075dd4bd72dc8e4f5c19ca227110f45f (diff)
VenueNameElement: fix off-by-one enum bounds check am: 48ee5f1e1c am: 37ec3aff4c
am: 2d03259907 Change-Id: I3aec7dac23cd6e384c5b65d29d90263f1fbf34c3
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/anqp/VenueNameElement.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/anqp/VenueNameElement.java b/service/java/com/android/server/wifi/anqp/VenueNameElement.java
index f0b27dd33..f944c4098 100644
--- a/service/java/com/android/server/wifi/anqp/VenueNameElement.java
+++ b/service/java/com/android/server/wifi/anqp/VenueNameElement.java
@@ -29,13 +29,13 @@ public class VenueNameElement extends ANQPElement {
int group = payload.get() & Constants.BYTE_MASK;
int type = payload.get() & Constants.BYTE_MASK;
- if (group >= VenueGroup.values().length) {
+ if (group >= VenueGroup.Reserved.ordinal()) {
mGroup = VenueGroup.Reserved;
mType = VenueType.Reserved;
} else {
mGroup = VenueGroup.values()[group];
type += sGroupBases.get(mGroup);
- if (type >= VenueType.values().length) {
+ if (type >= VenueType.Reserved.ordinal()) {
mType = VenueType.Reserved;
} else {
mType = VenueType.values()[type];
@@ -82,7 +82,7 @@ public class VenueNameElement extends ANQPElement {
UtilityMiscellaneous,
Vehicular,
Outdoor,
- Reserved
+ Reserved // Note: this must be the last enum constant
}
public enum VenueType {
@@ -164,7 +164,7 @@ public class VenueNameElement extends ANQPElement {
BusStop,
Kiosk,
- Reserved
+ Reserved // Note: this must be the last enum constant
}
private static final VenueType[] PerGroup =