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

Re: svn commit: r993183 - in /subversion/trunk/subversion: include/ libsvn_diff/ libsvn_ra_serf/ libsvn_subr/ mod_dav_svn/reports/

From: Stefan Sperling <stsp_at_apache.org>
Date: Tue, 7 Sep 2010 02:26:17 +0200

On Tue, Sep 07, 2010 at 12:09:47AM -0000, stsp_at_apache.org wrote:
> Author: stsp
> Date: Tue Sep 7 00:09:46 2010
> New Revision: 993183
>
> URL: http://svn.apache.org/viewvc?rev=993183&view=rev
> Log:
> Introduce a new family of functions to parse numbers from strings.

> * subversion/mod_dav_svn/reports/replay.c
> (dav_svn__replay_report): Use svn_cstring_strtoi64() instead of atoi() for
> parsing CDATA of the "send-deltas" element.

Note that this causes mod_dav_svn to reject "send-deltas" with CDATA other
than zero or one. Our own clients should be fine with this, as they print an
svn_boolean_t, as the value for a %d format directive, into the XML stream.

But I'm not sure about 3rd party implementations.
Would we need to allow any values other than zero and one?

I think it's pretty clear that a boolean value was intended, and that the
implementation detail of using atoi() had the side-effect of allowing any
non-zero number to represent "true". But I don't know enough about the
compatibility rules for our http protocol to be sure.

> Modified: subversion/trunk/subversion/mod_dav_svn/reports/replay.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/replay.c?rev=993183&r1=993182&r2=993183&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/mod_dav_svn/reports/replay.c (original)
> +++ subversion/trunk/subversion/mod_dav_svn/reports/replay.c Tue Sep 7 00:09:46 2010
> @@ -466,10 +466,18 @@ dav_svn__replay_report(const dav_resourc
> }
> else if (strcmp(child->name, "send-deltas") == 0)
> {
> + apr_int64_t parsed_val;
> +
> cdata = dav_xml_get_cdata(child, resource->pool, 1);
> if (! cdata)
> return malformed_element_error("send-deltas", resource->pool);
> - send_deltas = atoi(cdata);
> + err = svn_cstring_strtoi64(&parsed_val, cdata, 0, 1, 10);
> + if (err)
> + {
> + svn_error_clear(err);
> + return malformed_element_error("send-deltas", resource->pool);
> + }
> + send_deltas = parsed_val ? TRUE : FALSE;
> }
> }
> }
>
Received on 2010-09-07 02:27:20 CEST

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