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

Re: malformed argument re-use in svn_client_url_from_path2

From: Ben Reser <ben_at_reser.org>
Date: Thu, 24 Oct 2013 13:36:18 -0700

On 10/24/13 11:44 AM, Maximo, Andre (GE Global Research) wrote:
> void CVCS::svnURLPath(CString& urlPath, const CString &fullPath)
>
> {
>
> apr_pool_t *local_pool = svn_pool_create(m_svn_pool);
>
> const char *url = NULL;
>
> svn_error_t *err = svn_client_url_from_path2(&url, fullPath, m_svn_ctx,
> m_svn_pool, local_pool);
>
> if (url != NULL)
>
> urlPath = CString(url);
>
> svn_pool_destroy(local_pool);
>
> }

Looking at this code more closely I see that you're passing
svn_client_url_from_path2() a pointer to a CString class. I'm guessing you're
using MFC based on that class name. So I suspect what you really needed on the
svn_client_url_from_path2() call is:

svn_error_t *err = svn_client_url_from_path2(&url, fullPath->GetBuffer(),
m_svn_ctx, m_svn_pool, local_pool);

Bert's and my earlier points about the lack of checking for errors still
stands. In this case our particular implementation is good enough that it
wouldn't break your code since url will still be NULL. But we don't promise that.

I think the fact that it's succeeding for you when passing a valid path is a
fluke and failing when passing a non-existent path is just a fluke.
Received on 2013-10-24 22:37:10 CEST

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

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