diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 2d0316f03..6afd8924e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,7 @@ +1999-10-26 Gary Houston + + * strports.c (st_end_input): avoid dubious pointer arithmetic. + 1999-10-24 Gary Houston * Move the responsibility for resetting port buffers from the diff --git a/libguile/strports.c b/libguile/strports.c index d76a6009c..19e2ba1b2 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -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) - scm_misc_error ("st_end_input", "negative position", SCM_EOL); - pt->write_pos = (unsigned char *) pt->read_pos = pos; + 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 = pt->read_pos - offset; pt->rw_active = SCM_PORT_NEITHER; }