$OpenBSD: patch-src_xscanimage_c,v 1.2 2009/02/14 10:05:21 jasper Exp $
--- src/xscanimage.c.orig	Sat Apr 16 15:12:07 2005
+++ src/xscanimage.c	Sat Feb 14 10:48:06 2009
@@ -1284,7 +1284,7 @@ scan_dialog (GtkWidget * widget, gpointer call_data)
     {				/* We are running in standalone mode */
       /* test for pnm formats */
       strncpy (testfilename, preferences.filename, sizeof (testfilename));
-      testfilename[sizeof (testfilename)] = 0;
+      testfilename[sizeof (testfilename) - 1] = 0;
       g_strreverse (testfilename);
       if (!((!strncmp (testfilename, "mnp.", 4)) ||
 	    (!strncmp (testfilename, "mgp.", 4)) ||
