You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2009/12/22 20:37:49 UTC

svn commit: r893283 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Author: stsp
Date: Tue Dec 22 19:37:49 2009
New Revision: 893283

URL: http://svn.apache.org/viewvc?rev=893283&view=rev
Log:
Follow-up to r884250:

* subversion/libsvn_fs_fs/fs_fs.c: Include apr_strings.h.
  (get_shared_txn, recover_find_max_ids): Use apr_cpystrn() instead
   of strncpy().

Suggested by: markphip
              philip
Review by: julianfoad

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=893283&r1=893282&r2=893283&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Dec 22 19:37:49 2009
@@ -34,6 +34,7 @@
 #include <apr_lib.h>
 #include <apr_md5.h>
 #include <apr_sha1.h>
+#include <apr_strings.h>
 #include <apr_thread_mutex.h>
 
 #include "svn_pools.h"
@@ -457,8 +458,7 @@
     }
 
   assert(strlen(txn_id) < sizeof(txn->txn_id));
-  strncpy(txn->txn_id, txn_id, sizeof(txn->txn_id) - 1);
-  txn->txn_id[sizeof(txn->txn_id) - 1] = '\0';
+  apr_cpystrn(txn->txn_id, txn_id, sizeof(txn->txn_id));
   txn->being_written = FALSE;
 
   /* Link this transaction into the head of the list.  We will typically
@@ -6641,14 +6641,12 @@
       if (svn_fs_fs__key_compare(node_id, max_node_id) > 0)
         {
           assert(strlen(node_id) < MAX_KEY_SIZE);
-          strncpy(max_node_id, node_id, MAX_KEY_SIZE - 1);
-          max_node_id[MAX_KEY_SIZE - 1] = '\0';
+          apr_cpystrn(max_node_id, node_id, MAX_KEY_SIZE);
         }
       if (svn_fs_fs__key_compare(copy_id, max_copy_id) > 0)
         {
           assert(strlen(copy_id) < MAX_KEY_SIZE);
-          strncpy(max_copy_id, copy_id, MAX_KEY_SIZE - 1);
-          max_copy_id[MAX_KEY_SIZE - 1] = '\0';
+          apr_cpystrn(max_copy_id, copy_id, MAX_KEY_SIZE);
         }
 
       if (kind == svn_node_file)