From aad1396c73be1e9dddb93dda9742e89ecf6219ea Mon Sep 17 00:00:00 2001 From: Tim DeLong Date: Wed, 30 Dec 2015 23:30:52 -0500 Subject: [PATCH] * CheckNameFilter was enforcing minimum surname length of 3 instead of 4. * Minor refactoring of CheckNameFilter to eliminate redundant code. --- common/database.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index dcc3fbe77..932aa4229 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1183,21 +1183,16 @@ bool Database::CheckNameFilter(const char* name, bool surname) { std::string str_name = name; - if(surname) + // the minimum 4 is enforced by the client too + if (!name || strlen(name) < 4) { - // the minimum 4 is enforced by the client too - if(!name || strlen(name) < 3) - { - return false; - } + return false; } - else + + // Given name length is enforced by the client too + if (!surname && strlen(name) > 15) { - // the minimum 4 is enforced by the client too - if(!name || strlen(name) < 4 || strlen(name) > 15) - { - return false; - } + return false; } for (size_t i = 0; i < str_name.size(); i++)