[前][次][番号順一覧][スレッド一覧]

ruby-changes:18572

From: naruse <ko1@a...>
Date: Wed, 19 Jan 2011 02:58:13 +0900 (JST)
Subject: [ruby-changes:18572] Ruby:r30595 (trunk): * vsnprintf.c (cvt): set first byte of buf to NUL for the case when

naruse	2011-01-19 02:56:10 +0900 (Wed, 19 Jan 2011)

  New Revision: 30595

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30595

  Log:
    * vsnprintf.c (cvt): set first byte of buf to NUL for the case when
      no bytes are written to the buf. [ruby-dev:43062]

  Modified files:
    trunk/ChangeLog
    trunk/vsnprintf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30594)
+++ ChangeLog	(revision 30595)
@@ -1,3 +1,8 @@
+Wed Jan 19 02:54:04 2011  NARUSE, Yui  <naruse@r...>
+
+	* vsnprintf.c (cvt): set first byte of buf to NUL for the case when
+	  no bytes are written to the buf. [ruby-dev:43062]
+
 Tue Jan 18 23:04:51 2011  Tanaka Akira  <akr@f...>
 
 	* gc.h: parenthesize macro arguments.
Index: vsnprintf.c
===================================================================
--- vsnprintf.c	(revision 30594)
+++ vsnprintf.c	(revision 30595)
@@ -1197,6 +1197,7 @@
 	else {
 	    digits = BSD__dtoa(value, mode, ndigits, decpt, &dsgn, &rve);
 	}
+	buf[0] = 0; /* rve - digits may be 0 */
 	memcpy(buf, digits, rve - digits);
 	xfree(digits);
 	rve = buf + (rve - digits);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]