smbd: Fix 240393 Uninitialized pointer read
authorVolker Lendecke <vl@samba.org>
Thu, 7 Jan 2016 20:33:18 +0000 (21:33 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 8 Jan 2016 04:44:15 +0000 (05:44 +0100)
If we run into the "This is a stream on the root of the share" case,
in old line 409 (new line 417) we "goto done;". If then in old line 1027
(new line 1035) "build_stream_path" fails, "start" is uninitialized.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan  8 05:44:15 CET 2016 on sn-devel-144

source3/smbd/filename.c

index c2ed1fc814d5f9c32bf738ef48d3d6e8c7a82c2a..f2c91845ade7fb5d4c129fbbe861a808bcf339b1 100644 (file)
@@ -235,7 +235,15 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                      uint32_t ucf_flags)
 {
        struct smb_filename *smb_fname = NULL;
-       char *start, *end;
+
+       /*
+        * This looks strange. But we need "start" initialized to "" here but
+        * it can't be a const char *, so 'char *start = "";' does not work.
+        */
+       char cnull = '\0';
+       char *start = &cnull;
+
+       char *end;
        char *dirpath = NULL;
        char *stream = NULL;
        bool component_was_mangled = False;