You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/06/23 02:30:10 UTC
svn commit: r416530 - /incubator/stdcxx/trunk/tests/src/printf.cpp
Author: sebor
Date: Thu Jun 22 17:30:10 2006
New Revision: 416530
URL: http://svn.apache.org/viewvc?rev=416530&view=rev
Log:
2006-06-22 Martin Sebor <se...@roguewave.com>
* printf.cpp (rw_vasnprintf): Used the number of bytes,
not elements, in the call to memcpy.
Modified:
incubator/stdcxx/trunk/tests/src/printf.cpp
Modified: incubator/stdcxx/trunk/tests/src/printf.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=416530&r1=416529&r2=416530&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/printf.cpp Thu Jun 22 17:30:10 2006
@@ -769,10 +769,11 @@
if (spec_bufsize == paramno) {
// grow the buffer of conversion specifiers
- FmtSpec* const tmp =
- (FmtSpec*)malloc (spec_bufsize * 2 * sizeof (FmtSpec));
+ const size_t bytesize = spec_bufsize * sizeof (FmtSpec);
+
+ FmtSpec* const tmp = (FmtSpec*)malloc (bytesize * 2);
if (tmp) {
- memcpy (tmp, pspec, spec_bufsize);
+ memcpy (tmp, pspec, bytesize);
if (pspec != specbuf)
free (pspec);
pspec = tmp;