This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup] Don't write garbage into the "extrakeys" user setting
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-apps at cygwin dot com
- Date: Mon, 27 Nov 2017 16:35:47 -0500
- Subject: [PATCH setup] Don't write garbage into the "extrakeys" user setting
- Authentication-results: sourceware.org; auth=none
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