From 5c22acadcbe5b01d910d75b71e86e06a425172d3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 24 Apr 2006 00:32:27 +0000 Subject: [PATCH] strip characters that are not in the set [a-zA-Z0-9-] from the local host name before using it in mDNS. (see #21) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1194 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/domain-util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c index ab1ec8d..3aeba12 100644 --- a/avahi-core/domain-util.c +++ b/avahi-core/domain-util.c @@ -42,7 +42,10 @@ static void strip_bad_chars(char *s) { s[strcspn(s, ".")] = 0; for (p = s, d = s; *p; p++) - if (isalnum(*p) || *p == '-') + if ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-') *(d++) = *p; *d = 0; -- 2.39.5