X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fdomain-util.c;h=3aeba1254b2f97664780cee857eebcc6a5d47d56;hb=59f3e8bef545762113c041a1ef5868e08b353045;hp=f5412264c20ea3382cd4432c30739ecfef628847;hpb=55357e3c75438ce83553d1c43d47e53eb7919d74;p=catta diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c index f541226..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; @@ -72,6 +75,9 @@ char *avahi_get_host_name(char *ret_s, size_t size) { if (*ret_s == 0) snprintf(ret_s, size, "unnamed"); } + + if (size >= AVAHI_LABEL_MAX) + ret_s[AVAHI_LABEL_MAX-1] = 0; return ret_s; }