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@winehq.org ReportedBy: timurrrr@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).