[Bug 19759] SLTG_ReadString does not null terminate

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Aug 17 10:11:37 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=19759





--- Comment #4 from Sunil Mohan Adapa <sunilmohan at fsf.org.in>  2009-08-17 10:11:37 ---
(In reply to comment #3)
> Something doesn't look right in your patch. SysAllocStringLen already
> zero-terminates it. This means something overwrites that last \0, which is the
> problem.

MSDN documentation for SysAllocStringLen says that when the input string is
NULL, the newly allocated buffer will be uninitialized. I assumed Wine was
doing the same while it seems to zero-fill. It may not be good to depend on
this Wine-only behaviour.

In light of this, our bug is purely because of the incorrect length (-1) passed
to SysAllocStringLen. MultiByteToWideChar's length will only include the NULL
if the input string has it.

> The only thing that can do that in this code is MultiByteToWideChar
> because it gets the wrong size...

These are purely ASCII strings with correctly interpreted length values (I
checked the binary file)

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list