Fixing a long standing bug in view.c
Pavel Roskin
proski at gnu.org
Wed Feb 26 18:08:34 UTC 2003
Hello, Philipp!
> view.c erroneously assumes it can easily malloc a file if mmap failed and
> passes view->s.st_size to g_malloc. But if largefile support has been enabled,
> view->s.st_size is a 64 bit value and thus possibly exceeds the limit of
> gulong which g_malloc takes for size. This patch fixes it.
I've applied a much simple patch for this:
/* 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);
Thank you for reporting the problem!
--
Regards,
Pavel Roskin
More information about the mc-devel
mailing list