[PATCH] comctl32: Fixed strncpy (Coverity)
Michael Stefaniuc
mstefani at redhat.com
Tue Jun 28 02:37:39 CDT 2011
Hello Marcus,
On 06/28/2011 09:15 AM, Marcus Meissner wrote:
> This is a 2 CHAR buffer, and we copy in 1 CHAR and \0. So just do that
> via strcpy() and dont confuse the static checker.
>
> CID 1194
>
> Ciao, Marcus
> ---
> dlls/comctl32/tests/treeview.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
> index 324473d..faa9553 100644
> --- a/dlls/comctl32/tests/treeview.c
> +++ b/dlls/comctl32/tests/treeview.c
> @@ -1225,7 +1225,7 @@ static void test_itemedit(void)
> r = TreeView_SelectItem(hTree, NULL);
> expect(TRUE, r);
> /* alter text */
> - strncpy(buff, "x", sizeof(buff)/sizeof(CHAR));
> + strcpy(buff, "x");
> r = SendMessage(edit, WM_SETTEXT, 0, (LPARAM)buff);
What about
r = SendMessage(edit, WM_SETTEXT, 0, (LPARAM)"x");
No strcpy involved.
> expect(TRUE, r);
> r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
bye
michael
More information about the wine-patches
mailing list