Bug 47225 - Wrong argument in redirectPath.setChars in Mapper.internalMapWrapper()
Summary: Wrong argument in redirectPath.setChars in Mapper.internalMapWrapper()
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.28
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2009-05-19 21:52 UTC by Konstantin Kolinko
Modified: 2009-10-03 09:24 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2009-05-19 21:52:39 UTC
Found in current trunk and tc6.0.x, and tc5.5.x:


730 : 	  	  	 if(mappingData.wrapper == null && noServletPath) {
731 : 	  	  	// The path is empty, redirect to "/"
732 : 	  	  	mappingData.redirectPath.setChars
733 : 	  	  	(path.getBuffer(), pathOffset, pathEnd);
734 : 	  	  	path.setEnd(pathEnd - 1);
735 : 	  	  	return;
736 : 	  	  	}

On line 733 the pathEnd argument is wrong:
it should be length, not an index.

It should be
 mappingData.redirectPath.setChars(path.getBuffer(), pathOffset, pathEnd-pathOffset);

Do not know, why there are no complaints. May be pathOffset is always zero?
Comment 1 Mark Thomas 2009-09-16 14:24:04 UTC
I'd guess pathOffset is (nearly) always zero. I have fixed it in trunk and proposed it for 6.0.x and 5.5.x
Comment 2 Mark Thomas 2009-09-27 10:23:58 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.
Comment 3 Mark Thomas 2009-10-03 09:24:58 UTC
This has been fixed in 5.5.x and will be included in 5.5.29 onwards.