[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r884250 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 22 Dec 2009 12:21:52 +0000

Stefan Sperling wrote:
> I'll stay out of the whole SVN_ERR_ASSERT discussion.
> If we boil down the diff as below is this OK?

> Index: subversion/libsvn_fs_fs/fs_fs.c
> ===================================================================
> --- subversion/libsvn_fs_fs/fs_fs.c (revision 892649)
> +++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
> @@ -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 @@ get_shared_txn(svn_fs_t *fs, const char *txn_id, s
> }
>
> 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 @@ recover_find_max_ids(svn_fs_t *fs, svn_revnum_t re
> 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);
> }

Looks good, yes.

- Julian
Received on 2009-12-22 13:22:32 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.