$OpenBSD: patch-src_fio_c,v 1.1 2005/08/23 20:43:40 fgsch Exp $
--- src/fio.c.orig	Tue Aug 23 16:46:29 2005
+++ src/fio.c	Tue Aug 23 16:47:41 2005
@@ -170,6 +170,7 @@ gint fio_get_values_from_file (const gch
 	gchar *buf;
 	const gchar *item;
 	va_list ap;
+	size_t len;
 	
 	buf = fio_get_file (filename);
 	
@@ -179,9 +180,11 @@ gint fio_get_values_from_file (const gch
 	/* because of the way we look for a matching variable name, which is
 		to look for an endline, the variable name, and a space, we insert a
 		newline at the beginning, so that the first variable name is caught. */
-	buf = g_realloc (buf, strlen (buf) + 1);
-	g_memmove (buf + 1, buf, strlen (buf));
+	len = strlen(buf);
+	buf = g_realloc (buf, len + 2);
+	g_memmove (buf + 1, buf, len);
 	buf[0] = '\n';
+	buf[len + 1] = '\0';
 	
 	va_start (ap, filename);
 
