* src/view.c (view_file_load_data): Do not to attempt to seek

beyond the end of file. Patch by Andrzej Zaborowski.
(view_moveto_addr_cmd): Display a warning message if the
user specified an invalid offset.
This commit is contained in:
Pavel Tsekov 2006-12-30 13:16:54 +00:00
parent b33ded92e8
commit 370c1d2cb2
2 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2006-12-30 Pavel Tsekov <ptsekov@gmx.net>
* view.c (view_file_load_data): Do not to attempt to seek
beyond the end of file. Patch by Andrzej Zaborowski.
(view_moveto_addr_cmd): Display a warning message if the
user specified an invalid offset.
2006-12-21 Pavel Tsekov <ptsekov@gmx.net>
* fsusage.c: Remove references to HAVE_INFOMOUNT.

View File

@ -540,6 +540,9 @@ view_file_load_data (WView *view, offset_type byte_index)
if (already_loaded (view->ds_file_offset, byte_index, view->ds_file_datalen))
return;
if (byte_index >= view->ds_file_filesize)
return;
blockoffset = offset_rounddown (byte_index, view->ds_file_datasize);
if (mc_lseek (view->ds_file_fd, blockoffset, SEEK_SET) == -1)
goto error;
@ -2757,6 +2760,8 @@ view_moveto_addr_cmd (WView *view)
addr = strtoul (line, &error, 0);
if ((*error == '\0') && get_byte (view, addr) != -1) {
view_moveto_offset (view, addr);
} else {
message (D_ERROR, _("Warning"), _(" Invalid address "));
}
}
g_free (line);