larryi 01/06/20 20:07:10
Modified: src/share/org/apache/tomcat/modules/server Ajp13.java
Log:
Port a couple of updates from tomcat_32 branch.
Fixed sign extension problem in doRead().
PR: 1673
Submitted by: Richard Evans ([EMAIL PROTECTED])
Fix buffer bounds check. This only fixes the calling of System.out.println().
An exception is still thrown on overflow. From what I can tell based on
how this routine is called, an overflow should never occur.
PR: 1528
Submitted by: [EMAIL PROTECTED]
Revision Changes Path
1.18 +2 -2
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java
Index: Ajp13.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Ajp13.java 2001/02/28 19:41:23 1.17
+++ Ajp13.java 2001/06/21 03:07:08 1.18
@@ -403,7 +403,7 @@
return -1;
}
}
- return (char) bodyBuff[pos++];
+ return bodyBuff[pos++] & 0xFF; // prevent sign extension of byte value
}
/**
@@ -864,7 +864,7 @@
*/
public void appendBytes( byte b[], int off, int numBytes ) {
appendInt( numBytes );
- if( pos + numBytes > buff.length ) {
+ if( pos + numBytes >= buff.length ) {
System.out.println("Buffer overflow " + buff.length + " " + pos + " "
+ numBytes );
// XXX Log
}