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