changeset 63:ffaa97a2c83a

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Dec 2018 08:57:46 +0100
parents eedd082355f9 (current diff) 89a114f36c42 (diff)
children e39c1ebb7a0e
files
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/MySQL/MySQLParameters.cpp	Wed Dec 05 08:57:16 2018 +0100
+++ b/Framework/MySQL/MySQLParameters.cpp	Wed Dec 05 08:57:46 2018 +0100
@@ -21,6 +21,8 @@
 
 #include "MySQLParameters.h"
 
+#include "MySQLDatabase.h"
+
 #include <Core/Logging.h>
 #include <Core/OrthancException.h>
 
@@ -116,14 +118,11 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
     }
     
-    for (size_t i = 0; i < database.length(); i++)
+    if (!MySQLDatabase::IsValidDatabaseIdentifier(database))
     {
-      if (!isalnum(database [i]))
-      {
-        LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a "
-                   << "database name: \"" << database << "\"";
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);          
-      }
+      LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a "
+                 << "database name: \"" << database << "\"";
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);          
     }
     
     database_ = database;