hostname-util: don't allow machine tags to begin/end with '-' or '.'
This commit is contained in:
committed by
Luca Boccassi
parent
7602d82407
commit
95c7dc3308
@@ -259,6 +259,12 @@ bool machine_tag_is_valid(const char *s) {
|
||||
if (n <= 0 || n >= 256)
|
||||
return false;
|
||||
|
||||
/* Don't allow "-" and "." as first or last char. (This is load-bearing, we want that "+"/"-" can be
|
||||
* used as prefix for adding/removing tags from the list). */
|
||||
if (strchr("-.", s[0]) ||
|
||||
strchr("-.", s[n-1]))
|
||||
return false;
|
||||
|
||||
return in_charset(s, ALPHANUMERICAL "-.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user