subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r1337441 - /subversion/trunk/subversion/libsvn_ra_serf/xml.c
Date Sat, 12 May 2012 04:28:29 GMT
Author: gstein
Date: Sat May 12 04:28:28 2012
New Revision: 1337441

URL: http://svn.apache.org/viewvc?rev=1337441&view=rev
Log:
Fix namespace expansion for unknown prefixes (in particular: avoid a
segfault).

* subversion/libsvn_ra_serf/xml.c:
  (svn_ra_serf__expand_ns): an unknown prefix should be assumed as
    part of the name, and definitely shouldn't segfault. simplify the
    function somewhat, by assigning to the OUT param rather than using
    an intermediate localvar.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/xml.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1337441&r1=1337440&r2=1337441&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Sat May 12 04:28:28 2012
@@ -158,37 +158,27 @@ svn_ra_serf__expand_ns(svn_ra_serf__dav_
                        const char *name)
 {
   const char *colon;
-  svn_ra_serf__dav_props_t prop_name;
 
   colon = strchr(name, ':');
   if (colon)
     {
       const svn_ra_serf__ns_t *ns;
 
-      prop_name.namespace = NULL;
-
       for (ns = ns_list; ns; ns = ns->next)
         {
           if (strncmp(ns->namespace, name, colon - name) == 0)
             {
-              prop_name.namespace = ns->url;
-              break;
+              returned_prop_name->namespace = ns->url;
+              returned_prop_name->name = colon + 1;
+              return;
             }
         }
-
-      SVN_ERR_ASSERT_NO_RETURN(prop_name.namespace);
-
-      prop_name.name = colon + 1;
-    }
-  else
-    {
-      /* use default namespace for now */
-      prop_name.namespace = "";
-      prop_name.name = name;
     }
 
-  *returned_prop_name = prop_name;
-  return;
+  /* If there is no prefix, or if the prefix is not found, then the
+     name is NOT within a namespace.  */
+  returned_prop_name->namespace = "";
+  returned_prop_name->name = name;
 }
 
 



Mime
View raw message