Bug in HTBufWrt.c

Hi all,

There is an infinite loop in HTBufWrt.c

In the function HTBufferWrite_write the code is :

while (1 ) {
  int available = me->data + me->allocated - me->read;
  /* If we have enough buffer space */
  if (len <= available) {
    ... 
   status = PUTBLOCK(...)
    (1)
  } else {
    ... 
   status = PUTBLOCK(...)
    (2)
  }   
}

Code (1) always returns.
Code (2) returns only if (status == HT_WOULD_BLOCK).
             It continues in the loop if (status == HT_OK).
       What about other status values ?
       If the remote host for any reason close the connection
       status will be HT_ERROR and the  HTBufferWrite_write 
       goes in infinite loop.

I suggest the following patch in line 210 :
   else return HT_ERROR;


MP.


               

Received on Monday, 11 June 2001 06:16:05 UTC