From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: [PATCH setup] Don't write garbage into the "extrakeys" user setting
Date: Mon, 27 Nov 2017 21:36:00 -0000 [thread overview]
Message-ID: <20171127213547.10816-1-kbrown@cornell.edu> (raw)
The ExtraKeysSetting destructor called UserSettings::set() on a string
that was terminated by LF instead of NUL. This led to garbage at the
end of the "extrakeys" setting that was written into setup.rc. Fix
this by replacing the final LF by NUL before calling set().
---
KeysSetting.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/KeysSetting.cc b/KeysSetting.cc
index a21c3c4..19c6df3 100644
--- a/KeysSetting.cc
+++ b/KeysSetting.cc
@@ -46,7 +46,11 @@ ExtraKeysSetting::ExtraKeysSetting ():
ExtraKeysSetting::~ExtraKeysSetting ()
{
if (keybuffer)
- UserSettings::instance().set ("extrakeys", keybuffer);
+ {
+ // Replace final LF with NUL.
+ keybuffer[bufsize - 1] = '\0';
+ UserSettings::instance().set ("extrakeys", keybuffer);
+ }
}
void
--
2.15.0
next reply other threads:[~2017-11-27 21:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 21:36 Ken Brown [this message]
2017-11-27 22:20 ` Ken Brown
2017-11-28 2:14 ` Ken Brown
2017-11-28 12:58 ` Ken Brown
2017-11-28 13:59 ` Ken Brown
2017-11-27 22:26 ` Jon Turney
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171127213547.10816-1-kbrown@cornell.edu \
--to=kbrown@cornell.edu \
--cc=cygwin-apps@cygwin.com \
/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.
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).