DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11434>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11434

Patch for incorrect buffer roll back after failed ushort write

           Summary: Patch for incorrect buffer roll back after failed ushort
                    write
           Product: Tomcat 4
           Version: Nightly Build
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Webapp
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


This patch contains 2 edits to pr_warp_packet.c

1. Removal of duplicate line in p_reset.

2. Removal of buffer pointer backup after failed p_write_ushort. The backup is
not needed because p_write_ushort does not advance the buffer pointer if it
failes (because there is not enough space left in the buffer).

The patched code was compiled and (briefly) tested under Apache 1.3.19, Red Hat
Linux 7.1 and Tomcat 4.0.1.Both mod_webapp.so and tomcat-webapp.jar were
deployed for the test.

Index: pr_warp_packet.c
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-connectors/webapp/lib/pr_warp_packet.c,v
retrieving revision 1.4
diff -u -r1.4 pr_warp_packet.c
--- pr_warp_packet.c    19 Jul 2001 23:52:40 -0000      1.4
+++ pr_warp_packet.c    2 Aug 2002 22:08:40 -0000
@@ -59,7 +59,6 @@

 void p_reset(warp_packet *pack) {
     pack->type=TYPE_INVALID;
-    pack->type=TYPE_INVALID;
     pack->size=0;
     pack->curr=0;
     pack->buff[0]='\0';
@@ -144,10 +143,7 @@
     if (x==NULL) return(p_write_ushort(pack,0));
     for (k=x; k[0]!='\0'; k++);
     len=k-x;
-    if (p_write_ushort(pack,len)==wa_false) {
-        pack->size-=2;
-        return(wa_false);
-    }
+    if (p_write_ushort(pack,len)==wa_false) return(wa_false);
     if ((pack->size+len)>65535) {
         pack->size-=2;
         return(wa_false);

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to