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

[PATCH] String creation -- ensuring space for the NUL

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 14 Feb 2012 12:26:54 +0000 (GMT)

For review, please. We discovered some bugs recently [1,2] with use of svn_string.h functions, where space for the terminating null character was sometimes not being allocated.  The attached patch file contains several changes in this area, which are all somewhat together although I'll commit them in two or more separate parts.  In summary:   * Introduce revved API svn_stringbuf_ensure2() that promises to make space for NUL.   * Make the old svn_stringbuf_ensure() provide space for NUL even though it doesn't promise to do so, to help remaining buggy callers to 'just work', since doing so is harmless and it was our inconsistent API that led to the misunderstanding.   * Change svn_stringbuf_create_empty() to avoid doing something funny with the allocated size field.   * Fix some debug code which could have spuriously failed because of miscalculating the allocated size.   * Clarify several doc strings. Not included in the current patch is updating all callers of svn_stringbuf_ensure() to use svn_stringbuf_ensure2() instead. [1] Email from Stefan Fuhrmann on 2012-02-12 in the thread "Error While Checking out Git Repository", <http://svn.haxx.se/dev/archive-2012-02/0380.shtml>. [2] Email from Julian Foad on 2012-02-09 in the thread "svn commit: r1242397 ...", <http://svn.haxx.se/dev/archive-2012-02/0320.shtml>. - Julian

Received on 2012-02-14 13:27:32 CET

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