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

Re: Purify is your friend.

From: <brane_at_xbc.nu>
Date: 2001-05-10 08:41:13 CEST

Quoting Greg Stein <gstein@lyra.org>:

> On Thu, May 10, 2001 at 12:17:33AM +0200, Branko �ibej wrote:
> > (Strictly speaking, this is an APR problem. But since it blew up in in
>
> > fs-test, and the culprit happens to be GregS, I thought y'all might
> like
> > to know about it. :-) )
>
> Okay... where'd it blow up, and will you be checking in a fix?

:-)

It dies in the FS when we're copying a key from a DBT to a pool. The data coming
from Berkeley DB is not 0-terminated, of course.

>
> > Here's the deal:
> >
> > apr_strings.h says:
> >
> > /**
> > * duplicate the first n characters of a string into memory allocated
>
> "of a string" typically implies something that is null-terminated.
>
> But if you want to clarify the doc in apr_strings.h, then please go
> ahead (I believe you have commit privs to APR, right?)

The thing is, one would expect apr_pstrndup to behave like the standard strn*
functions, which also operate on "string"s, but guarantee not to touch anything
past the "n". (It doesn't /have/ to, of course.)

Would it be O.K. if I changed the length check to use a memchr of '\0' instead
of strlen? The thing is, apart from this little problem, apr_pstrndup does
exactly what we need. We cant use apr_pmemdup, obviously, because we have to
end up with a 0-terminated string.

I could just go and clarify the doc, and change the FS, but it seems such a
waste ...

    Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:30 2006

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.