Bug 47225 - Wrong argument in redirectPath.setChars in Mapper.internalMapWrapper()
Wrong argument in redirectPath.setChars in Mapper.internalMapWrapper()
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.28
PC Windows XP
: P2 minor (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-05-19 21:52 UTC by Konstantin Kolinko
Modified: 2009-10-03 09:24 UTC (History)
0 users



Attachments

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:

http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?annotate=734728&pathrev=770809

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.