OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_buffer.c versions 1.5 and 1.6
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_buffer.c 1.5 -> 1.6

--- l2_ch_buffer.c       2001/08/15 10:36:03     1.5
+++ l2_ch_buffer.c       2001/08/22 18:12:16     1.6
@@ -92,12 +92,8 @@
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
         return L2_ERROR;
 
-    if (bufsize > (cfg->bufsize - cfg->bufpos)) {
-        if (downstream != NULL)
-            if (l2_channel_write(downstream, cfg->buf, cfg->bufpos) == L2_ERROR)
-                return L2_ERROR;
-        cfg->bufpos = 0;
-    }
+    if (bufsize > (cfg->bufsize - cfg->bufpos))
+        return L2_ERROR; /* The buffer is too small */
 
     memcpy(cfg->buf+cfg->bufpos, buf, bufsize);
     cfg->bufpos += bufsize;
@@ -117,6 +113,7 @@
             if (l2_channel_write(downstream, cfg->buf, cfg->bufpos) == L2_ERROR)
                 return L2_ERROR;
         cfg->bufpos = 0;
+        bzero(cfg->buf, cfg->bufsize); /* Guard against improper usage */
     }
 
     if (downstream != NULL)

CVSTrac 2.0.1