--- modules/file/spml.c.orig	2006-06-06 21:36:51.000000000 +0200
+++ modules/file/spml.c	2006-06-06 21:36:58.000000000 +0200
@@ -1174,7 +1174,7 @@
 {
     FILE *fh;
     gchar head[HEAD_SIZE];
-    gint score = 0;
+    gint n, score = 0;
 
     gwy_debug("%s", filename);
     if (g_str_has_suffix(filename, ".xml")) {
@@ -1185,8 +1185,9 @@
         return score;
     if (!(fh = fopen(filename, "rb")))
         return 0;
-    fread(head, 1, HEAD_SIZE, fh);
-    if (strstr("<SPML", head)) {
+    n = fread(head, 1, HEAD_SIZE, fh);
+    head[MAX(n-1, 0)] = '\0';
+    if (strstr(head, "<SPML")) {
         gwy_debug("Score += 50");
         score += 50;
     }

