[Bug 22514] New: lstrlen is incorrectly implemented in include/winbase.h

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Apr 28 07:53:07 CDT 2010


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

           Summary: lstrlen is incorrectly implemented in
                    include/winbase.h
           Product: Wine
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: -unknown
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: timurrrr at google.com


Hi.

I've been running Chromium tests under wine under Valgrind (see
http://wiki.winehq.org/Wine_and_Valgrind ) and found an incorrect
implementation of lstrlen in Wine.

According to MSDN, lstrlen should return 0 if the argument is NULL
See http://msdn.microsoft.com/en-us/library/ms647492(VS.85).aspx

In include/winbase.h I found this:
>>>>>>>>>
extern inline INT WINAPI lstrlenW( LPCWSTR str )
{
    const WCHAR *s = str; 
    while (*s) s++; 
    return s - str; 
}

extern inline INT WINAPI lstrlenA( LPCSTR str )
{
    return strlen( str );
}
<<<<<<<<<
Both implementations handle the "str=NULL" case incorrectly.
strlen segfaults on Linux if you simply call strlen(NULL).

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