windows.cfg: Add lstrlen() configuration and tests. (#1239)

Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms647492(v=vs.85).aspx
This commit is contained in:
Sebastian 2018-05-17 15:43:01 +02:00 committed by GitHub
parent e2ea82908a
commit aa3722feea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -4220,6 +4220,18 @@ HFONT CreateFont(
<strz/>
</arg>
</function>
<!-- int WINAPI lstrlen(_In_ LPCTSTR lpString); -->
<function name="lstrlen,lstrlenA,lstrlenW">
<use-retval/>
<returnValue type="int"/>
<noreturn>false</noreturn>
<leak-ignore/>
<warn severity="style" alternatives="StringCbLength,StringCchLength">Due to security concerns it is not recommended to use this function, see MSDN for details.</warn>
<arg nr="1">
<not-uninit/>
<strz/>
</arg>
</function>
<!--HANDLE WINAPI CreateSemaphore(
_In_opt_ LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
_In_ LONG lInitialCount,

View File

@ -163,6 +163,11 @@ void validCode()
HLOCAL pLocalAlloc = LocalAlloc(1, 2);
LocalFree(pLocalAlloc);
// cppcheck-suppress lstrlenCalled
(void)lstrlen(bufTC);
// cppcheck-suppress lstrlenCalled
(void)lstrlen(NULL);
// Intrinsics
__noop();
__noop(1, "test", NULL);
@ -485,6 +490,10 @@ void ignoredReturnValue()
// cppcheck-suppress ignoredReturnValue
_fileno(stdio);
// cppcheck-suppress lstrlenCalled
// cppcheck-suppress ignoredReturnValue
lstrlen(TEXT("test"));
}
void invalidFunctionArg()