* view.c (load_view_file): Make sure view->s.st_size is not
truncated when passed to g_malloc(). Reported by Philipp Thomas <pthomas@suse.de>
Этот коммит содержится в:
родитель
6df9219f85
Коммит
c6311c4ca5
@ -1,3 +1,9 @@
|
||||
2003-02-26 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* view.c (load_view_file): Make sure view->s.st_size is not
|
||||
truncated when passed to g_malloc().
|
||||
Reported by Philipp Thomas <pthomas@suse.de>
|
||||
|
||||
2003-02-23 Dmitry Alexeyev <dmi_a@qnx.org.ru>
|
||||
|
||||
* key.c (get_modifier): Add support for QNX Neutrino console.
|
||||
|
12
src/view.c
12
src/view.c
@ -585,13 +585,15 @@ load_view_file (WView *view, int fd)
|
||||
}
|
||||
#endif /* HAVE_MMAP */
|
||||
|
||||
/* For those OS that dont provide mmap call. Try to load all the
|
||||
* file into memory (alex@bcs.zaporizhzhe.ua). Also, mmap can fail
|
||||
/* For the OSes that don't provide mmap call, try to load all the
|
||||
* file into memory (alex@bcs.zaporizhzhe.ua). Also, mmap can fail
|
||||
* for any reason, so we use this as fallback (pavel@ucw.cz) */
|
||||
|
||||
view->data = (unsigned char *) g_malloc (view->s.st_size);
|
||||
if (view->data == NULL
|
||||
|| mc_lseek (view->file, 0, SEEK_SET) != 0
|
||||
/* Make sure view->s.st_size is not truncated when passed to g_malloc */
|
||||
if ((gulong) view->s.st_size == view->s.st_size)
|
||||
view->data = (unsigned char *) g_malloc ((gulong) view->s.st_size);
|
||||
|
||||
if (view->data == NULL || mc_lseek (view->file, 0, SEEK_SET) != 0
|
||||
|| mc_read (view->file, view->data,
|
||||
view->s.st_size) != view->s.st_size) {
|
||||
if (view->data != NULL)
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user