GNU bug report logs -
#38794
26.1; Warnings in w32 build
Previous Next
Reported by: Cecilio Pardo <cpardo <at> imayhem.com>
Date: Sun, 29 Dec 2019 16:05:02 UTC
Severity: wishlist
Tags: patch, wontfix
Found in version 26.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38794 in the body.
You can then email your comments to 38794 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38794
; Package
emacs
.
(Sun, 29 Dec 2019 16:05:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Cecilio Pardo <cpardo <at> imayhem.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 29 Dec 2019 16:05:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Severity: wishlist
Tags: patch
I am getting some warnings building with mingw64, using gcc 9.2.0. It
complies about possible buffer overruns with sprintf. Maybe upgrade to snprintf?
This is the warnings message:
addpm.c: In function 'main':
addpm.c:291:37: warning: '\bin\' directive writing 5 bytes into a region of size between 2 and 261 [-Wformat-overflow=]
291 | sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
| ^~~~~~~
addpm.c:291:8: note: 'sprintf' output between 18 and 277 bytes into a destination of size 261
291 | sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/nt/addpm.c b/nt/addpm.c
index 3fd1b1bdc0..7da1fb5424 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -257,7 +257,7 @@ main (int argc, char *argv[])
char full_emacs_path[MAX_PATH + 1];
IPersistFile *lnk;
strcat (start_folder, "\\Emacs.lnk");
- sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
+ snprintf (full_emacs_path, sizeof (full_emacs_path), "%s\\bin\\%s", emacs_path, prog_name);
IShellLinkA_SetPath (shortcut, full_emacs_path);
IShellLinkA_SetDescription (shortcut, "GNU Emacs");
result = IShellLinkA_QueryInterface (shortcut, &IID_IPersistFile,
@@ -288,7 +288,7 @@ main (int argc, char *argv[])
char full_emacs_path[MAX_PATH + 1];
IPersistFile *lnk;
strcat (start_folder, "\\Emacs.lnk");
- sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
+ snprintf (full_emacs_path, sizeof (full_emacs_path), "%s\\bin\\%s", emacs_path, prog_name);
IShellLinkA_SetPath (shortcut, full_emacs_path);
IShellLinkA_SetDescription (shortcut, "GNU Emacs");
result = IShellLinkA_QueryInterface (shortcut, &IID_IPersistFile,
--
Cecilio Pardo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38794
; Package
emacs
.
(Sun, 29 Dec 2019 17:21:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 38794 <at> debbugs.gnu.org (full text, mbox):
tags 38794 wontfix
close 38794
thanks
> From: Cecilio Pardo <cpardo <at> imayhem.com>
> Date: Sun, 29 Dec 2019 17:04:41 +0100
>
> I am getting some warnings building with mingw64, using gcc 9.2.0. It
> complies about possible buffer overruns with sprintf. Maybe upgrade to snprintf?
>
> This is the warnings message:
>
> addpm.c: In function 'main':
> addpm.c:291:37: warning: '\bin\' directive writing 5 bytes into a region of size between 2 and 261 [-Wformat-overflow=]
> 291 | sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
> | ^~~~~~~
> addpm.c:291:8: note: 'sprintf' output between 18 and 277 bytes into a destination of size 261
> 291 | sprintf (full_emacs_path, "%s\\bin\\%s", emacs_path, prog_name);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
They are bogus, obviously, and we would like to deprecate and remove
addpm at some future point. So I see no reason to make it compile
cleanly with GCC's too radical warning options.
So I'm closing this bug report.
Thank you anyway for your interest in Emacs and for providing a patch.
Added tag(s) wontfix.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 29 Dec 2019 17:21:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
38794 <at> debbugs.gnu.org and Cecilio Pardo <cpardo <at> imayhem.com>
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 29 Dec 2019 17:21:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 27 Jan 2020 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 138 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.