Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30146/compiler/algebra
Modified Files:
Tag: XQuery_0-22
algebra.c
Log Message:
Reevaluated the use of (v)snprintf.
On Windows, as on Linux, the size argument is the size of the buffer
to which is printed. The difference between Linux and Windows is that
on Linux if the data doesn't fit, the buffer is still NUL-terminated
(and truncated, obviously), but on Windows the data is truncated but
not NUL-terminated.
The upshot of this is that we can use the correctly-sized buffers, but
we must make sure that truncated buffers are properly NUL-terminated.
Index: algebra.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra.c,v
retrieving revision 1.69.4.1
retrieving revision 1.69.4.2
diff -u -d -r1.69.4.1 -r1.69.4.2
--- algebra.c 22 Feb 2008 10:39:19 -0000 1.69.4.1
+++ algebra.c 22 Feb 2008 15:13:14 -0000 1.69.4.2
@@ -971,6 +971,7 @@
snprintf (res, len, "%s%u", "pos", id);
else if (att & att_item)
snprintf (res, len, "%s%u", "item", id);
+ res[len] = 0;
return res;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins