Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CFCC5965B for ; Thu, 24 Nov 2011 14:37:10 +0000 (UTC) Received: (qmail 95756 invoked by uid 500); 24 Nov 2011 14:37:10 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 95731 invoked by uid 500); 24 Nov 2011 14:37:10 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 95724 invoked by uid 99); 24 Nov 2011 14:37:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2011 14:37:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2011 14:37:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C162D2388860 for ; Thu, 24 Nov 2011 14:36:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1205848 - /subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c Date: Thu, 24 Nov 2011 14:36:48 -0000 To: commits@subversion.apache.org From: philip@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111124143648.C162D2388860@eris.apache.org> Author: philip Date: Thu Nov 24 14:36:47 2011 New Revision: 1205848 URL: http://svn.apache.org/viewvc?rev=1205848&view=rev Log: Fix a potential read beyond allocated memory. * subversion/libsvn_fs_base/bdb/locks-table.c (svn_fs_bdb__locks_get): When the BDB key is a path don't rely on it being null terminated. Modified: subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c Modified: subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c?rev=1205848&r1=1205847&r2=1205848&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c (original) +++ subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c Thu Nov 24 14:36:47 2011 @@ -207,6 +207,7 @@ svn_fs_bdb__locks_get(svn_fs_t *fs, svn_lock_t *lock; svn_error_t *err; const char *lookup_path = path; + apr_size_t lookup_len; /* First, try to lookup PATH itself. */ err = svn_fs_bdb__lock_token_get(&lock_token, fs, path, trail, pool); @@ -255,11 +256,13 @@ svn_fs_bdb__locks_get(svn_fs_t *fs, if (!svn_fspath__is_root(path, strlen(path))) lookup_path = apr_pstrcat(pool, path, "/", (char *)NULL); + lookup_len = strlen(lookup_path); /* As long as the prefix of the returned KEY matches LOOKUP_PATH we know it is either LOOKUP_PATH or a decendant thereof. */ while ((! db_err) - && strncmp(lookup_path, key.data, strlen(lookup_path)) == 0) + && lookup_len < key.size + && strncmp(lookup_path, key.data, lookup_len) == 0) { const char *child_path;