Index: ossp-pkg/sio/al.c RCS File: /v/ossp/cvs/ossp-pkg/sio/Attic/al.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/sio/Attic/al.c,v' 2>/dev/null --- 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;