changeset 2295:5465cab476cf

Fix issue #45 (crash when providing a folder to "--config" command-line option)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Jul 2017 12:26:31 +0200
parents e371519d4ac9
children 17e8e8e1ff3d
files NEWS OrthancServer/main.cpp
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Jul 04 15:36:19 2017 +0000
+++ b/NEWS	Wed Jul 05 12:26:31 2017 +0200
@@ -22,6 +22,7 @@
 * Ability to retrieve raw frames encoded as unsigned 32-bits integers
 * Fix issue 35 (AET name is not transferred to Orthanc using DCMTK 3.6.0)
 * Fix issue 44 (Bad interpretation of photometric interpretation MONOCHROME1)
+* Fix issue 45 (crash when providing a folder to "--config" command-line option)
 * Fix issue 49 (Worklists: accentuated characters are removed from C-Find responses)
 * Fix Debian #865606 (orthanc FTBFS with libdcmtk-dev 3.6.1~20170228-2)
 * Fix XSS inside DICOM in Orthanc Explorer (as reported by Victor Pasnkel, Morphus Labs)
--- a/OrthancServer/main.cpp	Tue Jul 04 15:36:19 2017 +0000
+++ b/OrthancServer/main.cpp	Wed Jul 05 12:26:31 2017 +0200
@@ -1207,8 +1207,17 @@
 #endif
 
       std::string target = argument.substr(9);
-      SystemToolbox::WriteFile(configurationSample, target);
-      return 0;
+
+      try
+      {
+        SystemToolbox::WriteFile(configurationSample, target);
+        return 0;
+      }
+      catch (OrthancException&)
+      {
+        LOG(ERROR) << "Cannot write sample configuration as file \"" << target << "\"";
+        return -1;
+      }
     }
     else
     {