From: Lennart Poettering Date: Mon, 24 Apr 2006 00:32:27 +0000 (+0000) Subject: strip characters that are not in the set [a-zA-Z0-9-] from the local host name before... X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=5c22acadcbe5b01d910d75b71e86e06a425172d3;p=catta 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 --- 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;