From: Pierre Ossman Date: Thu, 2 Sep 2021 14:28:16 +0000 (+0200) Subject: Tolerate carriage return in config files X-Git-Tag: v1.11.90~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4d4e3b28973f6e5d3ab42833c922e79ed6148f0f;p=tigervnc.git 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. --- 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, '=');