diff --git a/src/kits/package/PackageInfo.cpp b/src/kits/package/PackageInfo.cpp index 15e425859e..89e645f26e 100644 --- a/src/kits/package/PackageInfo.cpp +++ b/src/kits/package/PackageInfo.cpp @@ -802,7 +802,7 @@ BPackageInfo::Parser::_Parse(BPackageInfo* packageInfo) _ParseStringValue(&name, &namePos); int32 errorPos; - if (!_IsAlphaNumUnderscore(name, ".", &errorPos)) { + if (!_IsValidResolvableName(name, &errorPos)) { throw ParseError("invalid character in package name", namePos + errorPos); } @@ -941,21 +941,14 @@ BPackageInfo::Parser::_IsAlphaNumUnderscore(const char* start, const char* end, BPackageInfo::Parser::_IsValidResolvableName(const char* string, int32* _errorPos) { - int32 errorPos; - if (const char* colon = strchr(string, ':')) { - if (_IsAlphaNumUnderscore(string, colon, ".", &errorPos)) { - if (_IsAlphaNumUnderscore(colon + 1, ".", &errorPos)) - return true; - errorPos += colon + 1 - string; + for (const char* c = string; *c != '\0'; c++) { + if (*c == '-' || *c == '/' || isspace(*c)) { + if (_errorPos != NULL) + *_errorPos = c - string; + return false; } - } else { - if (_IsAlphaNumUnderscore(string, ".", &errorPos)) - return true; } - - if (_errorPos != NULL) - *_errorPos = errorPos; - return false; + return true; }