subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1557094 - in /subversion/trunk/subversion/mod_dav_svn: util.c version.c
Date Fri, 10 Jan 2014 11:44:06 GMT
Author: rhuijben
Date: Fri Jan 10 11:44:06 2014
New Revision: 1557094

URL: http://svn.apache.org/r1557094
Log:
* subversion/mod_dav_svn/util.c
  (dav_svn__build_uri): Avoid segfault when root_path is "". This case
    should be unreachable after the other change, but this is hard to tell.

* subversion/mod_dav_svn/version.c
  (get_option):
    Don't advertise http-v2 support urls unless there is an actual repository
    These urls won't work anyway, as that would require a working repository
    at this location.

Found by: lgo

Modified:
    subversion/trunk/subversion/mod_dav_svn/util.c
    subversion/trunk/subversion/mod_dav_svn/version.c

Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1557094&r1=1557093&r2=1557094&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Fri Jan 10 11:44:06 2014
@@ -237,10 +237,11 @@ dav_svn__build_uri(const dav_svn_repos *
   const char *href1 = add_href ? "<D:href>" : "";
   const char *href2 = add_href ? "</D:href>" : "";
 
-  /* The first character of root_path is guaranteed to be "/".  If
-     there's no component beyond that, then just use "", so that
-     appending another "/" later does not result in "//". */
-  if (root_path[1] == '\0')
+  /* The first character of root_path is guaranteed to be "/" for
+     every location except the server root.  If there's no component
+     beyond that, then just use "", so that appending another "/"
+     later does not result in "//". */
+  if (root_path[0] == '/' && root_path[1] == '\0')
     root_path = "";
 
   switch (what)

Modified: subversion/trunk/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/version.c?rev=1557094&r1=1557093&r2=1557094&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/version.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/version.c Fri Jan 10 11:44:06 2014
@@ -177,9 +177,6 @@ get_option(const dav_resource *resource,
            apr_text_header *option)
 {
   request_rec *r = resource->info->r;
-  const char *repos_root_uri =
-    dav_svn__build_uri(resource->info->repos, DAV_SVN__BUILD_URI_PUBLIC,
-                       SVN_IGNORED_REVNUM, "", 0, resource->pool);
 
   /* ### DAV:version-history-collection-set */
   if (elem->ns == APR_XML_NS_DAV_ID)
@@ -265,11 +262,15 @@ get_option(const dav_resource *resource,
 
   /* Welcome to the 2nd generation of the svn HTTP protocol, now
      DeltaV-free!  If we're configured to advise this support, do so.  */
-  if (resource->info->repos->v2_protocol)
+  if (resource->info->repos->v2_protocol
+      && resource->info->repos->repos)
     {
       int i;
       svn_version_t *master_version = dav_svn__get_master_version(r);
       dav_svn__bulk_upd_conf bulk_upd_conf = dav_svn__get_bulk_updates_flag(r);
+      const char *repos_root_uri =
+            dav_svn__build_uri(resource->info->repos, DAV_SVN__BUILD_URI_PUBLIC,
+                               SVN_IGNORED_REVNUM, "", 0, resource->pool);
 
       /* The list of Subversion's custom POSTs and which versions of
          Subversion support them.  We need this latter information



Mime
View raw message