OSSP CVS Repository

ossp - Check-in [2576]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2576
Date: 2002-Oct-14 15:45:47 (local)
2002-Oct-14 13:45:47 (UTC)
User:mlelstv
Branch:
Comment: stop traversal at span boundary code cleanup

PR: Submitted by: Reviewed by: Approved by: Obtained from:

Tickets:
Inspections:
Files:
ossp-pkg/sio/al.c      1.4 -> 1.5     6 inserted, 1 deleted

ossp-pkg/sio/al.c 1.4 -> 1.5

--- al.c 2002/10/14 13:34:25     1.4
+++ al.c 2002/10/14 13:45:47     1.5
@@ -770,7 +770,10 @@
 {
     size_t step;
 
-    if (txp->cur == NULL)
+    if (txp->togo <= 0)     /* XXX - togo can be negative from bad input */
+        return AL_ERR_EOF;
+
+    if (txp->cur == NULL)   /* premature EOF */
         return AL_ERR_EOF;
 
     step = AL_CHUNK_LEN(txp->cur);
@@ -847,6 +850,8 @@
     al_chunk_t *view;
     size_t step, total;
 
+    *lenp = 0; /* keep caller on safe side */
+
     rc = al_traverse(al, off, n, AL_FORWARD, &tx);
     if (rc != AL_OK) return rc;
 

CVSTrac 2.0.1