From ec2d35edc391c92db909d95c84c0ab2499fee448 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 30 Mar 2005 21:59:40 +0000 Subject: [PATCH] handle the unlikely case that no bytes are read from the file and allocate 2005-03-30 Sven Neumann * glib/gfileutils.c (get_contents_stdio): handle the unlikely case that no bytes are read from the file and allocate an empty string. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gfileutils.c | 3 +++ 5 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index a3fc71f5..2f70103c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-03-30 Sven Neumann + + * glib/gfileutils.c (get_contents_stdio): handle the unlikely case + that no bytes are read from the file and allocate an empty string. + 2005-03-30 Tor Lillqvist * glib/giowin32.c (g_io_win32_fd_get_flags_internal): Always claim diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a3fc71f5..2f70103c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2005-03-30 Sven Neumann + + * glib/gfileutils.c (get_contents_stdio): handle the unlikely case + that no bytes are read from the file and allocate an empty string. + 2005-03-30 Tor Lillqvist * glib/giowin32.c (g_io_win32_fd_get_flags_internal): Always claim diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index a3fc71f5..2f70103c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2005-03-30 Sven Neumann + + * glib/gfileutils.c (get_contents_stdio): handle the unlikely case + that no bytes are read from the file and allocate an empty string. + 2005-03-30 Tor Lillqvist * glib/giowin32.c (g_io_win32_fd_get_flags_internal): Always claim diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a3fc71f5..2f70103c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2005-03-30 Sven Neumann + + * glib/gfileutils.c (get_contents_stdio): handle the unlikely case + that no bytes are read from the file and allocate an empty string. + 2005-03-30 Tor Lillqvist * glib/giowin32.c (g_io_win32_fd_get_flags_internal): Always claim diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 05cd33e2..36652152 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -523,6 +523,9 @@ get_contents_stdio (const gchar *display_filename, fclose (f); + if (total_bytes == 0) + str = g_new (gchar, 1); + str[total_bytes] = '\0'; if (length) -- 2.34.1