Prevent segfaults on long paths. (#447935, Robby Griffin)

2007-06-17  Matthias Clasen  <mclasen@redhat.com>

        * glib/gutils (g_get_current_dir): Prevent segfaults on
        long paths.  (#447935, Robby Griffin)


svn path=/trunk/; revision=5574
This commit is contained in:
Matthias Clasen 2007-06-18 16:35:41 +00:00 committed by Matthias Clasen
parent 3bbb4d6dbd
commit 7a6d2233e4
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-06-17 Matthias Clasen <mclasen@redhat.com>
* glib/gutils (g_get_current_dir): Prevent segfaults on
long paths. (#447935, Robby Griffin)
2007-06-17 Behdad Esfahbod <behdad@gnome.org>
* glib/gdataset.c (g_quark_from_string),
@ -16,7 +21,7 @@
called. (#447583)
* glib/gthread.c (g_static_mutex_free): Clarified comment to
remind myself, tha calling g_static_mutex_free() before
remind myself, that calling g_static_mutex_free() before
g_thread_init() is safe.
2007-06-15 Cody Russell <bratsche@gnome.org>

View File

@ -964,6 +964,7 @@ g_get_current_dir (void)
#else /* !sun || !HAVE_GETCWD */
while (max_len < G_MAXULONG / 2)
{
g_free (buffer);
buffer = g_new (gchar, max_len + 1);
*buffer = 0;
dir = getcwd (buffer, max_len);
@ -971,7 +972,6 @@ g_get_current_dir (void)
if (dir || errno != ERANGE)
break;
g_free (buffer);
max_len *= 2;
}
#endif /* !sun || !HAVE_GETCWD */