[ros-diffs] [hpoussin] 18152: Don't tell to MultiByteToWideChar that buffer is bigger than its real size. The size is in characters, not in bytes.

hpoussin at svn.reactos.com hpoussin at svn.reactos.com
Thu Sep 29 11:46:40 CEST 2005


Don't tell to MultiByteToWideChar that buffer is bigger than its real
size. The size is in characters, not in bytes.
Spotted by Robert Shearman <rob at codeweavers.com>
Modified: trunk/reactos/lib/setupapi/parser.c
  _____  

Modified: trunk/reactos/lib/setupapi/parser.c
--- trunk/reactos/lib/setupapi/parser.c	2005-09-29 03:39:38 UTC (rev
18151)
+++ trunk/reactos/lib/setupapi/parser.c	2005-09-29 09:46:35 UTC (rev
18152)
@@ -956,8 +956,7 @@

         WCHAR *new_buff = HeapAlloc( GetProcessHeap(), 0, size *
sizeof(WCHAR) );
         if (new_buff)
         {
-            DWORD len = MultiByteToWideChar( CP_ACP, 0, buffer, size,
new_buff,
-                                             size * sizeof(WCHAR) );
+            DWORD len = MultiByteToWideChar( CP_ACP, 0, buffer, size,
new_buff, size );
             err = parse_buffer( file, new_buff, new_buff + len,
error_line );
             HeapFree( GetProcessHeap(), 0, new_buff );
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050929/4e58d85c/attachment.html


More information about the Ros-diffs mailing list