[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong pointer comparison in w32fns.c
From: |
Po Lu |
Subject: |
Re: Wrong pointer comparison in w32fns.c |
Date: |
Sun, 30 Oct 2022 08:57:17 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Juanma Barranquero <lekktu@gmail.com> writes:
> Presumably, this is a bug in rarely used code (affecting NT 4 systems):
>
> CC w32fns.o
> w32fns.c: In function 'setup_w32_kbdhook':
> w32fns.c:2738:24: warning: the comparison will always evaluate as 'true' for
> the address of 'newTitle' will never be NULL [-Waddress]
> 2738 | if (newTitle != NULL)
> | ^~
> w32fns.c:2733:19: note: 'newTitle' declared here
> 2733 | wchar_t newTitle[64];
> | ^~~~~~~~
>
> requiring something like this:
>
> diff --git i/src/w32fns.c w/src/w32fns.c
> index 5f652ae9e4..46c73f762a 100644
> --- i/src/w32fns.c
> +++ w/src/w32fns.c
> @@ -2734,8 +2734,7 @@ setup_w32_kbdhook (void)
> int i;
>
> CoCreateGuid (&guid);
> - StringFromGUID2 (&guid, newTitle, 64);
> - if (newTitle != NULL)
> + if (StringFromGUID2 (&guid, newTitle, 64) && newTitle[0])
Does this function support Windows 9x?
http://winapi.freetechsecrets.com/ole/OLEStringFromGUID2.htm says
nothing about that.