Revision: 5210
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5210&view=rev
Author:   mdboom
Date:     2008-05-21 06:03:36 -0700 (Wed, 21 May 2008)

Log Message:
-----------
Be a little more pedantic about sscanf usage and check the return value.

Modified Paths:
--------------
    trunk/matplotlib/src/_tkagg.cpp

Modified: trunk/matplotlib/src/_tkagg.cpp
===================================================================
--- trunk/matplotlib/src/_tkagg.cpp     2008-05-21 12:10:35 UTC (rev 5209)
+++ trunk/matplotlib/src/_tkagg.cpp     2008-05-21 13:03:36 UTC (rev 5210)
@@ -76,7 +76,10 @@
         return TCL_ERROR;
     }
     /* get array (or object that can be converted to array) pointer */
-    sscanf (argv[2],"%lu",&aggl);
+    if (sscanf (argv[2],"%lu",&aggl) != 1) {
+        Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+        return TCL_ERROR;
+    }
     aggo = (PyObject*)aggl;
     //aggo = (PyObject*)atol(argv[2]);
 
@@ -97,7 +100,10 @@
     }
 
     /* check for bbox/blitting */
-    sscanf (argv[4],"%lu",&bboxl);
+    if (sscanf (argv[4],"%lu",&bboxl) != 1) {
+        Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+        return TCL_ERROR;
+    }
     bboxo = (PyObject*)bboxl;
 
     //bboxo = (PyObject*)atol(argv[4]);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to