1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* strports.c (st_end_input): avoid dubious pointer arithmetic.

This commit is contained in:
Gary Houston 1999-10-26 18:42:11 +00:00
parent 2d9e5bca6c
commit cd19d608b1
2 changed files with 8 additions and 5 deletions

View file

@ -1,3 +1,7 @@
1999-10-26 Gary Houston <ghouston@freewire.co.uk>
* strports.c (st_end_input): avoid dubious pointer arithmetic.
1999-10-24 Gary Houston <ghouston@freewire.co.uk>
* Move the responsibility for resetting port buffers from the

View file

@ -149,12 +149,11 @@ static void
st_end_input (SCM port, int offset)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
const unsigned char *pos = pt->read_pos - offset;
if (pos < pt->read_buf)
if (pt->read_pos - pt->read_buf < offset)
scm_misc_error ("st_end_input", "negative position", SCM_EOL);
pt->write_pos = (unsigned char *) pt->read_pos = pos;
pt->write_pos = (unsigned char *) pt->read_pos = pt->read_pos - offset;
pt->rw_active = SCM_PORT_NEITHER;
}