diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 8992203d6..46f200ddf 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -1157,7 +1157,7 @@ write_to_file (const gchar *contents, { gssize s; - s = write (fd, contents, length); + s = write (fd, contents, MIN (length, G_MAXSSIZE)); if (s < 0) {