833445c
commit c4cb247732767aed76502069d0b3040c4c4e5123
833445c
Author: Nils Philippsen <nils@redhat.com>
833445c
Date:   Fri Jul 31 16:21:53 2009 +0200
833445c
833445c
    patch: array-out-of-bounds
833445c
    
833445c
    Squashed commit of the following:
833445c
    
833445c
    commit 337bcefaa7a67931095b74317a266a1244978ab6
833445c
    Author: Nils Philippsen <nils@redhat.com>
833445c
    Date:   Fri Jul 31 16:03:28 2009 +0200
833445c
    
833445c
        fix array subscript out of bounds errors (#133121)
833445c
833445c
diff --git a/src/xcam.c b/src/xcam.c
833445c
index 2d494a5..f6859b7 100644
833445c
--- a/src/xcam.c
833445c
+++ b/src/xcam.c
833445c
@@ -1289,7 +1289,7 @@ save_frame_button (GtkWidget * widget, gpointer client_data,
833445c
 
05de8f8
       /* test for pnm formats */
05de8f8
       strncpy (testfilename, preferences.filename, sizeof (testfilename));
05de8f8
-      testfilename[sizeof (testfilename)] = 0;
05de8f8
+      testfilename[sizeof (testfilename) - 1] = 0;
05de8f8
       g_strreverse (testfilename);
05de8f8
       if (!((!strncmp (testfilename, "mnp.", 4)) ||
05de8f8
 	    (!strncmp (testfilename, "mgp.", 4)) ||
833445c
diff --git a/src/xscanimage.c b/src/xscanimage.c
833445c
index a36324f..065923d 100644
833445c
--- a/src/xscanimage.c
833445c
+++ b/src/xscanimage.c
833445c
@@ -1284,7 +1284,7 @@ scan_dialog (GtkWidget * widget, gpointer call_data)
833445c
     {				/* We are running in standalone mode */
05de8f8
       /* test for pnm formats */
05de8f8
       strncpy (testfilename, preferences.filename, sizeof (testfilename));
05de8f8
-      testfilename[sizeof (testfilename)] = 0;
05de8f8
+      testfilename[sizeof (testfilename) - 1] = 0;
05de8f8
       g_strreverse (testfilename);
05de8f8
       if (!((!strncmp (testfilename, "mnp.", 4)) ||
05de8f8
 	    (!strncmp (testfilename, "mgp.", 4)) ||