unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Wrong pointer comparison in w32fns.c
Date: Sun, 30 Oct 2022 00:36:20 +0200	[thread overview]
Message-ID: <CAAeL0STrMMp-g4HhuRy020QJf5T6uAZOnMMHfMfMsG9YfxQ8aA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

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])
     {
       GetConsoleTitleW (oldTitle, 1024);
       SetConsoleTitleW (newTitle);

[-- Attachment #2: Type: text/html, Size: 1154 bytes --]

             reply	other threads:[~2022-10-29 22:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 22:36 Juanma Barranquero [this message]
2022-10-30  0:57 ` Wrong pointer comparison in w32fns.c Po Lu
2022-10-30  6:47   ` Eli Zaretskii
2022-10-30  6:24 ` Eli Zaretskii
2022-10-30 12:13   ` Juanma Barranquero
2022-10-30 12:47     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0STrMMp-g4HhuRy020QJf5T6uAZOnMMHfMfMsG9YfxQ8aA@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).