mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 18:16:34 +02:00
Report an error if the file is too large. (#315275, Kjartan Maraas)
2005-09-05 Matthias Clasen <mclasen@redhat.com> * glib/gmappedfile.c (g_mapped_file_new): Report an error if the file is too large. (#315275, Kjartan Maraas)
This commit is contained in:
committed by
Matthias Clasen
parent
08710ea187
commit
837e4dcd9a
@@ -1,5 +1,8 @@
|
|||||||
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmappedfile.c (g_mapped_file_new): Report an error
|
||||||
|
if the file is too large. (#315275, Kjartan Maraas)
|
||||||
|
|
||||||
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
||||||
of read() is signed. (#315273, Kjartan Maraas)
|
of read() is signed. (#315273, Kjartan Maraas)
|
||||||
|
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmappedfile.c (g_mapped_file_new): Report an error
|
||||||
|
if the file is too large. (#315275, Kjartan Maraas)
|
||||||
|
|
||||||
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
||||||
of read() is signed. (#315273, Kjartan Maraas)
|
of read() is signed. (#315273, Kjartan Maraas)
|
||||||
|
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmappedfile.c (g_mapped_file_new): Report an error
|
||||||
|
if the file is too large. (#315275, Kjartan Maraas)
|
||||||
|
|
||||||
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
* glib/gkeyfile.c (g_key_file_load_from_fd): The return value
|
||||||
of read() is signed. (#315273, Kjartan Maraas)
|
of read() is signed. (#315273, Kjartan Maraas)
|
||||||
|
|
||||||
|
@@ -140,10 +140,17 @@ g_mapped_file_new (const gchar *filename,
|
|||||||
file->contents = MAP_FAILED;
|
file->contents = MAP_FAILED;
|
||||||
|
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
file->length = st.st_size;
|
if (st.st_size > G_MAXSIZE)
|
||||||
file->contents = (gchar *) mmap (NULL, st.st_size,
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file->length = (gsize) st.st_size;
|
||||||
|
file->contents = (gchar *) mmap (NULL, file->length,
|
||||||
writable ? PROT_READ|PROT_WRITE : PROT_READ,
|
writable ? PROT_READ|PROT_WRITE : PROT_READ,
|
||||||
MAP_PRIVATE, fd, 0);
|
MAP_PRIVATE, fd, 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
file->length = st.st_size;
|
file->length = st.st_size;
|
||||||
|
Reference in New Issue
Block a user