Extended validation for CommonAPI Addresses
[profile/ivi/common-api-dbus-runtime.git] / src / CommonAPI / DBus / DBusAddressTranslator.cpp
index f433047..a1c836e 100644 (file)
@@ -128,8 +128,11 @@ void DBusAddressTranslator::readConfigFile(std::ifstream& addressConfigFile) {
                 dbusToCommonApiAddress.insert( {std::get<0>(serviceDetails), currentlyParsedCommonApiAddress});
             }
             reset(serviceDetails);
-            currentlyParsedCommonApiAddress = readLine.substr(1, readLineLength - 2);
-            newAddressFound = commonApiAddressDetails.find(currentlyParsedCommonApiAddress) == commonApiAddressDetails.end();
+            std::string newAddress = readLine.substr(1, readLineLength - 2);
+            if (isValidCommonApiAddress(newAddress)) {
+                currentlyParsedCommonApiAddress = std::move(newAddress);
+                newAddressFound = commonApiAddressDetails.find(currentlyParsedCommonApiAddress) == commonApiAddressDetails.end();
+            }
 
         } else if (newAddressFound) {
             readValue(readLine, serviceDetails);