On Tue, Sep 07, 2010 at 12:09:47AM -0000, s...@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; > } > } > } >