summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 891182a35b..11cab6dcf1 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4248,6 +4248,11 @@ bool hostname_is_valid(const char *s) {
if (isempty(s))
return false;
+ /* Doesn't accept empty hostnames, hostnames with trailing or
+ * leading dots, and hostnames with multiple dots in a
+ * sequence. Also ensures that the length stays below
+ * HOST_NAME_MAX. */
+
for (p = s, dot = true; *p; p++) {
if (*p == '.') {
if (dot)