Mercurial > hg > orthanc-databases
changeset 61:89a114f36c42
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2018 17:26:18 +0100 |
parents | 412e30336847 |
children | ffaa97a2c83a |
files | Framework/MySQL/MySQLParameters.cpp |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/MySQL/MySQLParameters.cpp Mon Nov 19 15:06:08 2018 +0100 +++ b/Framework/MySQL/MySQLParameters.cpp Thu Nov 29 17:26:18 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;