diff options
author | Pierre Ossman <ossman@cendio.se> | 2021-09-02 16:28:16 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2021-09-02 16:28:16 +0200 |
commit | 4d4e3b28973f6e5d3ab42833c922e79ed6148f0f (patch) | |
tree | a9bb9a3e81f8751c95279e864e54fc16815f5f21 | |
parent | 3fe718c1429a39ac8690e3ced9ca80d1f81773cc (diff) | |
download | tigervnc-4d4e3b28973f6e5d3ab42833c922e79ed6148f0f.tar.gz tigervnc-4d4e3b28973f6e5d3ab42833c922e79ed6148f0f.zip |
Tolerate carriage return in config files
If the file has been transferred from a Windows system then it might
have \r\n line endings instead of \n. Make sure this doesn't leak in to
the parameter values.
-rw-r--r-- | vncviewer/parameters.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index a4e18363..8db714ae 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -776,6 +776,10 @@ char* loadViewerParameters(const char *filename) { line[len-1] = '\0'; len--; } + if (line[len-1] == '\r') { + line[len-1] = '\0'; + len--; + } // Find the parameter value char *value = strchr(line, '='); |