[Bug 19839] Access violation when closing ImgBurn 2.5.0.0 if its 'Disc Layout Editor' window has ever been opened.

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Aug 26 04:51:10 CDT 2009


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





--- Comment #11 from LIGHTNING UK! <lightning_uk at imgburn.com>  2009-08-26 04:51:10 ---
Oops, seems that if size is 0, windows actually returns the number of
characters that *would* be copied into the buffer *if* there was sufficient
allocation.

So this should work?

    len = strlenW (infoPtr->parts[0].text);

    if(size == 0)
    {
      return len;
    }
    else if(size > len)
    {
      strcpyW (buf, infoPtr->parts[0].text);
      return len;
    }
    else
    {
      memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR));
      buf[size - 1] = 0; // This has to be 'size - 1' rather than just 'size'
or you'll get an access overrun?
      return size - 1;
    }

-- 
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