Author: fireball
Date: Sun Jun 29 04:39:06 2008
New Revision: 34180
URL:
http://svn.reactos.org/svn/reactos?rev=34180&view=rev
Log:
- Revert 22081 by Magnus Olsen:
"fixing two hiden bug in reactos, null termante the string right at end, code tested
in vs, but it seam no affact on wine test mscvrt printf test. What hell is the snprintf
function call to ??".
Instead of fixing "hidden bugs", it introduced a real very well hidden bug,
which was overwriting the target buffer and thus corrupting everything starting from the
heap, and ending with pools. It's possible to install and run OO2 Writer now.
See issue #3311 for more details.
Modified:
trunk/reactos/lib/rtl/sprintf.c
trunk/reactos/lib/rtl/swprintf.c
Modified: trunk/reactos/lib/rtl/sprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sprintf.c?rev=3418…
==============================================================================
--- trunk/reactos/lib/rtl/sprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/sprintf.c [iso-8859-1] Sun Jun 29 04:39:06 2008
@@ -691,20 +691,8 @@
if (str <= end)
*str = '\0';
else if (cnt > 0)
- {
/* don't write out a null byte if the buf size is zero */
- //*end = '\0';
- if (str-buf >cnt )
- {
- *end = '\0';
- }
- else
- {
- end++;
- *end = '\0';
- }
-
- }
+ *end = '\0';
return str-buf;
}
Modified: trunk/reactos/lib/rtl/swprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/swprintf.c?rev=341…
==============================================================================
--- trunk/reactos/lib/rtl/swprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/swprintf.c [iso-8859-1] Sun Jun 29 04:39:06 2008
@@ -689,21 +689,9 @@
}
if (str <= end)
*str = L'\0';
- else if (cnt > 0)
- {
+ else if (cnt > 0)
/* don't write out a null byte if the buf size is zero */
- //*end = '\0';
- if (str-buf >cnt )
- {
- *end = L'\0';
- }
- else
- {
- end++;
- *end = L'\0';
- }
-
- }
+ *end = L'\0';
return str-buf;
}