subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1158174 - /subversion/trunk/subversion/svn/status.c
Date Tue, 16 Aug 2011 09:47:56 GMT
Author: rhuijben
Date: Tue Aug 16 09:47:55 2011
New Revision: 1158174

URL: http://svn.apache.org/viewvc?rev=1158174&view=rev
Log:
* subversion/svn/status.c
  (make_relpath): Handle the (theoretical) segfault when the two paths have
    nothing in common. (In that case svn_dirent_skip_ancestor would return NULL
    and the while loop at the end of this function would segfault)

Modified:
    subversion/trunk/subversion/svn/status.c

Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1158174&r1=1158173&r2=1158174&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Tue Aug 16 09:47:55 2011
@@ -148,11 +148,22 @@ make_relpath(const char *relative_to_pat
   /* An example:
    *  relative_to_path = /a/b/c
    *  target_path      = /a/x/y/z
-   *  result           = ../../x/y/z */
+   *  result           = ../../x/y/z 
+   *
+   * Another example (Windows specific):
+   *  relative_to_path = F:/wc
+   *  target_path      = C:/wc
+   *  result           = C:/wc
+   */
 
   /* Skip the common ancestor of both paths, here '/a'. */
   la = svn_dirent_get_longest_ancestor(relative_to_path, target_path,
                                        scratch_pool);
+  if (*la == '\0')
+    {
+      /* Nothing in common: E.g. C:/ vs F:/ on Windows */
+      return apr_pstrdup(result_pool, target_path);
+    }
   relative_to_path = svn_dirent_skip_ancestor(la, relative_to_path);
   target_path = svn_dirent_skip_ancestor(la, target_path);
 



Mime
View raw message