You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2012/08/24 05:59:52 UTC

svn commit: r1376823 - in /subversion/branches/1.7.x: ./ STATUS subversion/libsvn_subr/dirent_uri.c subversion/tests/libsvn_subr/dirent_uri-test.c

Author: svn-role
Date: Fri Aug 24 03:59:51 2012
New Revision: 1376823

URL: http://svn.apache.org/viewvc?rev=1376823&view=rev
Log:
Merge r1376414 from trunk:

 * r1376414
   Fix a memory read bug.
   Justification:
     Undefined behaviour.
   Votes:
     +1: philip, stsp, rhuijben

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c
    subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1376414

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1376823&r1=1376822&r2=1376823&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Fri Aug 24 03:59:51 2012
@@ -130,10 +130,3 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1376414
-   Fix a memory read bug.
-   Justification:
-     Undefined behaviour.
-   Votes:
-     +1: philip, stsp, rhuijben
-

Modified: subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c?rev=1376823&r1=1376822&r2=1376823&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c Fri Aug 24 03:59:51 2012
@@ -1437,7 +1437,7 @@ svn_dirent_skip_ancestor(const char *par
   apr_size_t len = strlen(parent_dirent);
   apr_size_t root_len;
 
-  if (0 != memcmp(parent_dirent, child_dirent, len))
+  if (0 != strncmp(parent_dirent, child_dirent, len))
     return NULL; /* parent_dirent is no ancestor of child_dirent */
 
   if (child_dirent[len] == 0)
@@ -1495,7 +1495,7 @@ svn_relpath_skip_ancestor(const char *pa
   if (len == 0)
     return child_relpath;
 
-  if (0 != memcmp(parent_relpath, child_relpath, len))
+  if (0 != strncmp(parent_relpath, child_relpath, len))
     return NULL; /* parent_relpath is no ancestor of child_relpath */
 
   if (child_relpath[len] == 0)
@@ -1518,7 +1518,7 @@ uri_skip_ancestor(const char *parent_uri
   assert(svn_uri_is_canonical(parent_uri, NULL));
   assert(svn_uri_is_canonical(child_uri, NULL));
 
-  if (0 != memcmp(parent_uri, child_uri, len))
+  if (0 != strncmp(parent_uri, child_uri, len))
     return NULL; /* parent_uri is no ancestor of child_uri */
 
   if (child_uri[len] == 0)

Modified: subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1376823&r1=1376822&r2=1376823&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c Fri Aug 24 03:59:51 2012
@@ -1357,6 +1357,9 @@ static const testcase_ancestor_t dirent_
     { "foo.",           "foo./.bar",        ".bar" },
     { "X:foo",          "X:bar",            NULL },
     { "../foo",         "..",               NULL },
+    { "/foo/bar/zig",   "/foo",             NULL },
+    { "/foo/bar/zig",   "/foo/ba",          NULL },
+    { "/foo/bar/zig",   "/foo/bar/zi",      NULL },
 #ifdef SVN_USE_DOS_PATHS
     { "",               "C:",               NULL },
     { "",               "C:foo",            NULL },
@@ -1377,6 +1380,9 @@ static const testcase_ancestor_t dirent_
     { "X:/foo",         "X:/",              NULL },
     { "A:/foo",         "A:/foo/bar",       "bar" },
     { "A:/foo",         "A:/foot",          NULL },
+    { "A:/foo/bar/zig", "A:/foo",           NULL },
+    { "A:/foo/bar/zig", "A:/foo/ba",        NULL },
+    { "A:/foo/bar/zig", "A:/foo/bar/zi",    NULL },
     { "//srv",          "//srv/share",      NULL },
     { "//srv",          "//srv/shr/fld",    NULL },
     { "//srv/shr",      "//srv",            NULL },
@@ -1386,6 +1392,7 @@ static const testcase_ancestor_t dirent_
     { "//srv/s r",      "//srv/s r/fld",    "fld" },
     { "//srv/shr/fld",  "//srv/shr",        NULL },
     { "//srv/shr/fld",  "//srv2/shr/fld",   NULL },
+    { "//srv/shr/fld",  "//srv/shr/f",      NULL },
     { "/",              "//srv/share",      NULL },
 #else /* !SVN_USE_DOS_PATHS */
     { "",               "C:",               "C:" },
@@ -1473,6 +1480,8 @@ static const testcase_ancestor_t uri_anc
     { "http://",        "http://test",      NULL },
     { "http://server",  "http://server/q",  "q" },
     { "svn://server",   "http://server/q",  NULL },
+    { "http://foo/bar", "http://foo",       NULL },
+    { "http://foo/bar", "http://foo/ba",    NULL },
   };
 
 static svn_error_t *