[elinks-dev] Fix add_format_to_string.

Zas zas at norz.org
Wed Oct 1 07:20:33 PDT 2003


On Wed, Oct 01, 2003 at 02:16:48PM +0200, Karsten Schölzel wrote:
> Fix add_format_to_string.
> There must be `width + 1' instead of `newlength´ as argument to
> vsnprintf because the size attribute of vsnprintf includes the trailing
> null, but the return value doesn't.

> Index: src/util/string.c
> ===================================================================
> --- src/util/string.c	(revision 355)
> +++ src/util/string.c	(revision 356)
> @@ -398,7 +398,7 @@
>  	if (!realloc_string(string, newlength))
>  		return NULL;
>  
> -	vsnprintf(&string->source[string->length], newlength, format, ap);
> +	vsnprintf(&string->source[string->length], width + 1, format, ap);
>  
>  	va_end(ap);
>  

Applied to cvs. Thanks ;)

--

Zas



More information about the elinks-dev mailing list