Index: smbd/mangle_hash.c =================================================================== --- smbd/mangle_hash.c (revision 6974) +++ smbd/mangle_hash.c (working copy) @@ -95,6 +95,10 @@ } while (*s) { + if (*s <= 0x1f) { + /* Control characters. */ + return NT_STATUS_UNSUCCESSFUL; + } switch(*s) { case UCS2_CHAR('\\'): case UCS2_CHAR('/'): Index: smbd/mangle_hash2.c =================================================================== --- smbd/mangle_hash2.c (revision 6974) +++ smbd/mangle_hash2.c (working copy) @@ -633,6 +633,11 @@ memset(char_flags, 0, sizeof(char_flags)); for (i=1;i<128;i++) { + if (i <= 0x1f) { + /* Control characters. */ + char_flags[i] |= FLAG_ILLEGAL; + } + if ((i >= '0' && i <= '9') || (i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z')) { Index: smbd/reply.c =================================================================== --- smbd/reply.c (revision 6974) +++ smbd/reply.c (working copy) @@ -118,6 +118,9 @@ } if (!(*s & 0x80)) { + if (*s <= 0x1f) { + return NT_STATUS_OBJECT_NAME_INVALID; + } switch (*s) { case '*': case '?': @@ -244,6 +247,9 @@ } if (!(*s & 0x80)) { + if (*s <= 0x1f) { + return NT_STATUS_OBJECT_NAME_INVALID; + } *d++ = *s++; } else { switch(next_mb_char_size(s)) {