[Bug 22514] lstrlen is incorrectly implemented in include/winbase.h
wine-bugs at winehq.org
wine-bugs at winehq.org
Wed Apr 28 08:37:39 CDT 2010
http://bugs.winehq.org/show_bug.cgi?id=22514
Timur Iskhodzhanov <timurrrr at google.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|CLOSED |UNCONFIRMED
Resolution|INVALID |
--- Comment #4 from Timur Iskhodzhanov <timurrrr at google.com> 2010-04-28 08:37:39 ---
Ah, sorry.
However, I think the implementation in dlls/kernel32/string.c is wrong as well:
>>>>>>>>>>>>>>>>
INT WINAPI lstrlenA( LPCSTR str )
{
INT ret;
__TRY
{
ret = strlen(str);
}
__EXCEPT_PAGE_FAULT
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
__ENDTRY
return ret;
}
/***********************************************************************
* lstrlenW (KERNEL32.@)
*/
INT WINAPI lstrlenW( LPCWSTR str )
{
INT ret;
__TRY
{
ret = strlenW(str);
}
__EXCEPT_PAGE_FAULT
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
__ENDTRY
return ret;
}
<<<<<<<<<<<<<<<<<
As you can see, it calls SetLastError if we pass NULL as a parameter.
Also, it reads *(NULL) which is why Valgrind is reporting "uninitialized
reads". I don't think it's a good idea to read *(NULL) if we can easily do
without.
--
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