Skip to content

Commit 328ed22

Browse files
committed
Fix null-pointer vulnerability and restore Android compatibility
The loop checking the list of input extensions passed as a constructor parameter was blindly calling getClass() on any element in the list. This is not null safe and broke compatibility with some Android versions. Change the code to a null-safe instanceof check, which also restores Android compatibility. Fixes Issue #1353.
1 parent 8c5766a commit 328ed22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/java_websocket/drafts/Draft_6455.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public Draft_6455(List<IExtension> inputExtensions, List<IProtocol> inputProtoco
244244
boolean hasDefault = false;
245245
byteBufferList = new ArrayList<>();
246246
for (IExtension inputExtension : inputExtensions) {
247-
if (inputExtension.getClass().equals(DefaultExtension.class)) {
247+
if (inputExtension instanceof DefaultExtension) {
248248
hasDefault = true;
249249
}
250250
}

0 commit comments

Comments
 (0)