Menu

#40 PathParser.getRelative ArrayIndexOutOfBounds

open
nobody
Bug (26)
5
2013-02-15
2013-02-15
No

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);
}

Discussion


Log in to post a comment.

Auth0 Logo