r3720: fixed the pulling of zero length ucs2 strings in smbd. I found this
authorAndrew Tridgell <tridge@samba.org>
Sat, 13 Nov 2004 07:22:14 +0000 (07:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:46 +0000 (13:05 -0500)
bug using ifstest.exe, which is a IFS (Installable File System) test
suite. With this fix I was pleasantly surprised to find that Samba4
passes many (maybe even most?) of the tests in ifstest.

source/smb_server/request.c

index fddf63b1f71b9d05d0afa0836dfedeb99d52c264..8e83ea31b32614dc4bb316420aa94088d68228db 100644 (file)
@@ -489,6 +489,11 @@ static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const
        }
 
        src_len2 = utf16_len_n(src, src_len);
+       if (src_len2 == 0) {
+               *dest = talloc_strdup(req, "");
+               return src_len2 + alignment;
+       }
+
        ret = convert_string_talloc(req, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
 
        if (ret == -1) {