* view.c (get_byte): Fix off-by-one error. Found by Valgrind.

This commit is contained in:
Pavel Roskin 2003-06-06 23:54:20 +00:00
parent f0e6a9d522
commit bd9c9343eb
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2003-06-06 Pavel Roskin <proski@gnu.org>
* view.c (get_byte): Fix off-by-one error. Found by Valgrind.
* command.c (command_new): Fix memory leak.
* subshell.c (exit_subshell): Free pty_buffer.

View File

@ -336,7 +336,7 @@ get_byte (WView *view, unsigned int byte_index)
}
view->blocks = page;
}
if (byte_index > view->bytes_read) {
if (byte_index >= view->bytes_read) {
return -1;
} else
return view->block_ptr[page - 1].data[offset];