PathParser.getRelative ArrayIndexOutOfBounds
Brought to you by:
niallg
V5.0.4, in org.simpleframework.http.parse.PathParser,
public String getRelative(String path)
will throw an AIOB in
private String getRelative(char[] text, int off, int len)
when the "path" argument is shorter than the actual path. One could argue this is a user error because they should check the path length before calling getRelative, but the fix is simple:
private String getRelative(char[] text, int off, int len) {
if (len > path.len) return null; // JSD
...
}
testcase:
public void testAIOB(){
path.parse("/admin/ws");
String result = path.getRelative("/admin/ws/");
String expResult = null;
assertEquals(expResult, result);
}