aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/parameters.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-03-04 09:53:16 +0100
committerPierre Ossman <ossman@cendio.se>2015-03-04 09:53:16 +0100
commit3b865f1373b54240031b9fadf4a7bfaec53b4145 (patch)
treeeb50a566c5c95a4cb390f193cd699b0da30a15a4 /vncviewer/parameters.cxx
parentd7f8450c37722a2577b0ec6f496c69ba05cd80d8 (diff)
downloadtigervnc-3b865f1373b54240031b9fadf4a7bfaec53b4145.tar.gz
tigervnc-3b865f1373b54240031b9fadf4a7bfaec53b4145.zip
Fix bad long line detection logic in config file parser
Diffstat (limited to 'vncviewer/parameters.cxx')
-rw-r--r--vncviewer/parameters.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx
index 712a257a..7a868c7c 100644
--- a/vncviewer/parameters.cxx
+++ b/vncviewer/parameters.cxx
@@ -580,15 +580,16 @@ char* loadViewerParameters(const char *filename) {
// Read the next line
lineNr++;
if (!fgets(line, sizeof(line), f)) {
- if (line[sizeof(line) -1] != '\0')
- throw Exception(_("Failed to read line %d in file %s: %s"),
- lineNr, filepath, _("Line too long"));
if (feof(f))
break;
throw Exception(_("Failed to read line %d in file %s: %s"),
lineNr, filepath, strerror(errno));
}
+
+ if (strlen(line) == (sizeof(line) - 1))
+ throw Exception(_("Failed to read line %d in file %s: %s"),
+ lineNr, filepath, _("Line too long"));
// Make sure that the first line of the file has the file identifier string
if(lineNr == 1) {