Does someone with a system who can reproduce the problem want to try
out this patch?  I believe it may be more correct than the currently posted
one at <http://www.digitux.net/qpopper.patch>

  Line numbers might not quite match the stock qpopper when applied
with "patch" because I have been doing other development work on this
version.  

  This seems to produce more correct behavior on my systems, but as I
can't reproduce the hang-and-eat-CPU behavior, I can't tell if it
totally addresses the problem.
  -- Clifton

*** popper.c    2002/02/26 21:32:58     1.1
--- popper.c    2002/03/17 23:00:20
***************
*** 499,512 ****
              int   keep = 0;
              char *q   = NULL;
  
              _DEBUG_LOG0 ( pPOP, "...buffer full; discarding bytes" );
              while ( TRUE ) {
                  if ( pPOP->tls_started )
                      len = pop_tls_read ( pPOP->tls_context, junk, sizeof(junk) );
                  else
                      len = read ( pPOP->input_fd, junk, sizeof(junk) );
!                 if ( len <= 0 )
!                     break;
                  q = strchr ( junk, '\n' );
                  if ( q == NULL ) {
                      disc += len;
--- 499,533 ----
              int   keep = 0;
              char *q   = NULL;
  
+             /*
+              * Make sure junk is initialized, just as a matter of policy.
+              */
+             memset( junk, 0, sizeof(junk) );
+ 
              _DEBUG_LOG0 ( pPOP, "...buffer full; discarding bytes" );
              while ( TRUE ) {
                  if ( pPOP->tls_started )
                      len = pop_tls_read ( pPOP->tls_context, junk, sizeof(junk) );
                  else
                      len = read ( pPOP->input_fd, junk, sizeof(junk) );
!                 if ( len <= 0 ) {
!                     if ( errno == EAGAIN ||  errno == EINTR )
!                         /* 
!                          * There may still be some data
!                          */
!                         continue;
!                     else {
!                         /*
!                          * EOF or some other error - assume EOF.
!                          * Setup to return the junk before we started discarding
!                          */
!                         bcopy ( pPOP->pcInStart,
!                             str,
!                             MIN ( size, p - pPOP->pcInStart ) );
!                         *(str + size - 1) = '\0';
!                         break;
!                     }
!                 }
                  q = strchr ( junk, '\n' );
                  if ( q == NULL ) {
                      disc += len;
 
-- 
 Clifton Royston  --  LavaNet Systems Architect --  [EMAIL PROTECTED]
   WWJD?   "JWRTFM!" - Scott Dorsey (kludge)   "JWG" - Eddie Aikau

Reply via email to