Skip to content

Commit cf722df

Browse files
amosshiGoeLin
authored andcommitted
8267860: Off-by-one bug when searching arrays in AlpnGreaseTest
Backport-of: 2adef6a1f84d478bb38b179795f08ffa43680e36
1 parent 0beae37 commit cf722df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@ public class AlpnGreaseTest implements SSLContextTemplate {
8383
new String(greaseBytes, StandardCharsets.ISO_8859_1);
8484

8585
private static void findGreaseInClientHello(byte[] bytes) throws Exception {
86-
for (int i = 0; i < bytes.length - greaseBytes.length; i++) {
86+
for (int i = 0; i < bytes.length - greaseBytes.length + 1; i++) {
8787
if (Arrays.equals(bytes, i, i + greaseBytes.length,
8888
greaseBytes, 0, greaseBytes.length)) {
8989
System.out.println("Found greaseBytes in ClientHello at: " + i);

0 commit comments

Comments
 (0)