You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2013/07/29 12:11:50 UTC

svn commit: r1507993 - /subversion/trunk/subversion/tests/libsvn_subr/string-test.c

Author: philip
Date: Mon Jul 29 10:11:50 2013
New Revision: 1507993

URL: http://svn.apache.org/r1507993
Log:
Fix the out-of-bounds memory access in test_string_matching_test.  Follow-up
to r1505336.

* subversion/tests/libsvn_subr/string-test.c
  (test_string_matching): Correctly initialize the 'max_match' value to avoid
    out-of-bounds memory access.

Patch by: Evgeny Kotkov <evgeny.kotkov{_AT_}visualsvn.com>

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/string-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/string-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/string-test.c?rev=1507993&r1=1507992&r2=1507993&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/string-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/string-test.c Mon Jul 29 10:11:50 2013
@@ -812,7 +812,7 @@ test_string_matching(apr_pool_t *pool)
     {
       apr_size_t a_len = strlen(test->a);
       apr_size_t b_len = strlen(test->b);
-      apr_size_t max_match = MAX(a_len, b_len);
+      apr_size_t max_match = MIN(a_len, b_len);
       apr_size_t match_len
         = svn_cstring__match_length(test->a, test->b, max_match);
       apr_size_t rmatch_len