Update of /cvsroot/monetdb/pathfinder/runtime
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv456

Modified Files:
      Tag: Feb2010
        serialize.mx 
Log Message:
If there is code to set uri and prefix to NULL, you have to deal with
the possibility they are, in fact, NULL.
Found by Coverity.


Index: serialize.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize.mx,v
retrieving revision 1.124
retrieving revision 1.124.2.1
diff -u -d -r1.124 -r1.124.2.1
--- serialize.mx        7 Jan 2010 15:24:29 -0000       1.124
+++ serialize.mx        18 Feb 2010 10:09:35 -0000      1.124.2.1
@@ -492,7 +492,7 @@
 
     if ( fp ) {
 #ifdef DEBUGNS
-        stream_printf (GDKerr, "+NS:xmlNsPush(\"%s\",\"%s\")\n", prefix, uri);
+        stream_printf (GDKerr, "+NS:xmlNsPush(\"%s\",\"%s\")\n", prefix ? 
prefix : "", uri ? uri : "");
 #endif
         fp->prefix = NULL;
         fp->uri    = NULL;
@@ -687,7 +687,7 @@
     /* check in current node context if a namespace
        with this prefix is declared */
     while (fp) {
-        if (!strcmp (prefix, fp->prefix))
+        if (prefix && !strcmp (prefix, fp->prefix))
             break;
             
         fp = fp->prev;
@@ -708,7 +708,7 @@
     /* check in current node context if a namespace
        with this prefix is declared */
     while (fp) {
-        if (!strcmp (prefix, fp->prefix))
+        if (prefix && !strcmp (prefix, fp->prefix))
             break;
             
         if (fp == limit)
@@ -726,9 +726,10 @@
         return ctx->driverFun->@2 (ctx, prefix, loc, val);
     }
 
+    assert (prefix != NULL);
 
     /* uri and prefix match -> no namespace attribute needed */
-    if (!strcmp (uri, fp->uri))
+    if (uri && !strcmp (uri, fp->uri))
         return ctx->driverFun->@2 (ctx, prefix, loc, val);
 
 
@@ -738,7 +739,7 @@
     if (currentPrefix && 
         (currentUri = xmlNsUriFind (&ctx->nsTop, currentPrefix)) &&
         /* check if prefix has been redeclared */
-        !strcmp (currentUri, uri))
+        uri && !strcmp (currentUri, uri))
         return ctx->driverFun->@2 (ctx, currentPrefix, loc, val);
 
 


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to