<div dir="ltr">In general, I think you want to send this to wine-patches, not here.<div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 6, 2013 at 12:26 PM, Max Kellermann <span dir="ltr"><<a href="mailto:max@duempel.org" target="_blank">max@duempel.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The first memcpy() call in puts_clbk_str_w() confuses character count<br>
and byte count.  It uses the number of characters (out->len) as number<br>
of bytes.  This leaves half of the buffer undefined.<br>
<br>
Interestingly, the second memcpy() call in the same function is<br>
correct.<br>
<br>
This bug potentially makes applications expose internal (secret) data.<br>
Usually, the destination buffer is on the stack, and the stack often<br>
contains secrets.  Therefore, one could argue that this bug<br>
constitutes a security vulnerability.<br></blockquote><div><br></div><div style>It'd be hard to make that argument convincingly. That's neither here nor there, I suppose, but...</div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

---<br>
 dlls/msvcrt/printf.h |    2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h<br>
index cfba4b7..8b749bc 100644<br>
--- a/dlls/msvcrt/printf.h<br>
+++ b/dlls/msvcrt/printf.h<br>
@@ -48,7 +48,7 @@ static int FUNC_NAME(puts_clbk_str)(void *ctx, int len, const APICHAR *str)<br>
         return len;<br>
<br>
     if(out->len < len) {<br>
-        memcpy(out->buf, str, out->len);<br>
+        memcpy(out->buf, str, out->len*sizeof(APICHAR));<br>
         out->buf += out->len;<br></blockquote><div><br></div><div style>If the memcpy was incorrect, the += is also incorrect. I'm not sure which is the case, but either way, your patch can't be correct as is.</div>
<div style>--Juan</div></div></div></div>