Browse Source

Better string handling of default server name

We might not get one from the default configuration (we might not have
a default configuration at all), so make things more robust.
tags/v1.8.90
Pierre Ossman 6 years ago
parent
commit
b08a64898b
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      vncviewer/vncviewer.cxx

+ 5
- 3
vncviewer/vncviewer.cxx View File

@@ -519,11 +519,13 @@ int main(int argc, char** argv)
Configuration::enableViewerParams();

/* Load the default parameter settings */
char defaultServerName[VNCSERVERNAMELEN];
char defaultServerName[VNCSERVERNAMELEN] = "";
try {
strncpy(defaultServerName, loadViewerParameters(NULL), VNCSERVERNAMELEN);
const char* configServerName;
configServerName = loadViewerParameters(NULL);
if (configServerName != NULL)
strncpy(defaultServerName, configServerName, VNCSERVERNAMELEN);
} catch (rfb::Exception& e) {
strcpy(defaultServerName, "");
vlog.error("%s", e.str());
if (alertOnFatalError)
fl_alert("%s", e.str());

Loading…
Cancel
Save