summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/nbt/nbtname.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c
index fc87c2f4b2..bf545a6374 100644
--- a/source4/libcli/nbt/nbtname.c
+++ b/source4/libcli/nbt/nbtname.c
@@ -334,10 +334,11 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s)
{
int i, len;
char *ret;
- const char *valid_chars = "_-.$@";
+ const char *valid_chars = "_-.$@ ";
+#define NBT_CHAR_ALLOW(c) (isalnum(c) || strchr(valid_chars, c))
for (len=i=0;s[i];i++,len++) {
- if (!isalnum(s[i]) && !strchr(valid_chars, s[i])) {
+ if (!NBT_CHAR_ALLOW(s[i])) {
len += 2;
}
}
@@ -346,7 +347,7 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s)
if (ret == NULL) return NULL;
for (len=i=0;s[i];i++) {
- if (isalnum(s[i]) || strchr(valid_chars, s[i])) {
+ if (NBT_CHAR_ALLOW(s[i])) {
ret[len++] = s[i];
} else {
snprintf(&ret[len], 4, "%%%02x", (unsigned char)s[i]);