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

Re: Fixed length character buffers?

From: <kfogel_at_collab.net>
Date: 2005-12-03 00:05:38 CET

Erik Huelsmann <ehuels@gmail.com> writes:
> > + char keyword_buf[SVN_KEYWORD_MAX_LEN];
> > + apr_size_t keyword_off;
> > + char src_format[2];
>
> The segment above is from my last commit creating the eol-recoding stream.
>
> Here, and some other places in our code, we still use fixed length
> character buffers. I understand the case where we use them for MD5
> sums: APR expects us to.
>
> In the above case, nobody *wants* us to use a fixed character buffer.
> Using stringbufs, the above character limit (SVN_KEYWORD_MAX_LEN) can
> easily be lifted, if we want to.
>
> Also, I consider it not very future proof to build a 1.3 client with
> that constant: if later clients have a higher value for that
> constant...

Well, we control the keywords, so the only potential problem here is
that we might one day make a keyword longer than 255 characters and
forget to update SVN_KEYWORD_MAX_LEN...

...oh, wait: under some circumstances, that length has to include both
the keyword and its value. For example, see the strncmp() that
appears early in libsvn_subr/subst.c:translate_keyword_subst().

Do we have a problem right now? Have we just been lucky that no one's
had, say, a really long URL as the value of the $URL$ keyword?

-Karl

-- 
www.collab.net  <>  CollabNet  |  Distributed Development On Demand
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 3 01:29:43 2005

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