Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
2004-05-13  Jakub Jelinek  <jakub@redhat.com>

	* libio/genops.c (_IO_default_xsputn): Avoid one overflow per char if
	count is negative, yet write_ptr < write_end.
	(_IO_default_xsgetn): Avoid one underflow per char if count is
	negative, yet read_ptr < read_end.
  • Loading branch information
Ulrich Drepper committed May 13, 2004
1 parent 7f4311e commit f7803f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2004-05-13 Jakub Jelinek <jakub@redhat.com>

* libio/genops.c (_IO_default_xsputn): Avoid one overflow per char if
count is negative, yet write_ptr < write_end.
(_IO_default_xsgetn): Avoid one underflow per char if count is
negative, yet read_ptr < read_end.

2004-05-12 Steven Munroe <sjmunroe@us.ibm.com>

* sysdeps/unix/sysv/linux/powerpc/bits/termios.h (XTABS): Define XTABS
Expand Down
20 changes: 8 additions & 12 deletions libio/genops.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ _IO_default_xsputn (f, data, n)
for (;;)
{
/* Space available. */
_IO_ssize_t count = f->_IO_write_end - f->_IO_write_ptr;
if (count > 0)
if (f->_IO_write_ptr < f->_IO_write_end)
{
if ((_IO_size_t) count > more)
_IO_size_t count = f->_IO_write_end - f->_IO_write_ptr;
if (count > more)
count = more;
if (count > 20)
{
Expand All @@ -462,9 +462,7 @@ _IO_default_xsputn (f, data, n)
#endif
s += count;
}
else if (count <= 0)
count = 0;
else
else if (count)
{
char *p = f->_IO_write_ptr;
_IO_ssize_t i;
Expand Down Expand Up @@ -504,10 +502,10 @@ _IO_default_xsgetn (fp, data, n)
for (;;)
{
/* Data available. */
_IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr;
if (count > 0)
if (fp->_IO_read_ptr < fp->_IO_read_end)
{
if ((_IO_size_t) count > more)
_IO_size_t count = fp->_IO_read_end - fp->_IO_read_ptr;
if (count > more)
count = more;
if (count > 20)
{
Expand All @@ -519,9 +517,7 @@ _IO_default_xsgetn (fp, data, n)
#endif
fp->_IO_read_ptr += count;
}
else if (count <= 0)
count = 0;
else
else if (count)
{
char *p = fp->_IO_read_ptr;
int i = (int) count;
Expand Down

0 comments on commit f7803f5

Please sign in to comment.