[elinks-dev] Fix add_format_to_string.

Karsten Schölzel kuser at gmx.de
Wed Oct 1 05:16:48 PDT 2003


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.
-------------- next part --------------
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);
 


More information about the elinks-dev mailing list