[SCM] Samba Shared Repository - branch v4-6-test updated

Karolin Seeger kseeger at samba.org
Thu Jun 8 15:05:02 UTC 2017


The branch, v4-6-test has been updated
       via  ad1f953 shadow_copy_get_shadow_copy_data: fix GCC snprintf warning
       via  e550c8a ndr tests: silence a harmless warning
       via  123bfe0 s4:torture: Fix comparison between pointer and zero character constant
       via  fdcfdcd waf: Do not trhow a format-truncation error for test/snprintf.c
       via  3afa33b replace: Use the same size as d_name member of struct dirent
      from  553433a VERSION: Bump version up to 4.6.6...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-test


- Log -----------------------------------------------------------------
commit ad1f95356b88202eeaf0ebd5be59afb3af247c8d
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 9 13:02:52 2017 +1300

    shadow_copy_get_shadow_copy_data: fix GCC snprintf warning
    
    GCC 7 warns about snprintf truncating a dirent d_name (potentially 255 bytes) to 25 bytes,
    even though we have checked that it is 25 long in shadow_copy_match_name().
    
    Using strlcpy instead of snprintf lets us check it again, JUST TO BE SURE.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit a091a30a5bd50bc02df3e9c01b11f70c94dbd053)
    
    Autobuild-User(v4-6-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-6-test): Thu Jun  8 17:04:34 CEST 2017 on sn-devel-144

commit e550c8ae7dfb09cd1503a75083b25e5458d27b68
Author: Douglas Bagnall <douglas at halo.gen.nz>
Date:   Sat Feb 25 13:38:17 2017 +1300

    ndr tests: silence a harmless warning
    
    gcc 7.
    
    "duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]"
    
    Signed-off-by: Douglas Bagnall <douglas at halo.gen.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit f1b2d356585d43f2bac24d5c32cbef4a90c43f36)

commit 123bfe0250b38d08069237d39d0f6bb9960550d0
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jun 1 14:28:08 2017 +0200

    s4:torture: Fix comparison between pointer and zero character constant
    
    Fixes building with GCC 7.1
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 1f4b07e5942235bddcfa999b3575f719752d81c4)

commit fdcfdcd6f0bd74cb38797fa790907fa6787d507d
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jun 1 14:24:42 2017 +0200

    waf: Do not trhow a format-truncation error for test/snprintf.c
    
    This fixes building with GCC 7.1
    
    Error:
    ../lib/replace/test/testsuite.c:355:6: error: ‘%d’ directive output
    truncated writing 1 byte into a region of size 0
    [-Werror=format-truncation=]
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1670d00be88108a483f04c9763012504499b99e4)

commit 3afa33b1f63d7b50b5f7f4ea8c70fb6a5cfe32c6
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jun 1 14:16:56 2017 +0200

    replace: Use the same size as d_name member of struct dirent
    
    This fixes an error with GCC 7.1
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 94e21c139f9b0c1d28ee85fdcb9b7490cc64e27b)

-----------------------------------------------------------------------

Summary of changes:
 lib/replace/test/os2_delete.c     |  2 +-
 lib/replace/wscript               |  3 ++-
 source3/include/ntioctl.h         |  2 +-
 source3/modules/vfs_shadow_copy.c | 11 ++++++++++-
 source4/torture/masktest.c        |  2 +-
 source4/torture/ndr/string.c      | 20 ++++++++++----------
 6 files changed, 25 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/test/os2_delete.c b/lib/replace/test/os2_delete.c
index 0816f61..4b99ccf 100644
--- a/lib/replace/test/os2_delete.c
+++ b/lib/replace/test/os2_delete.c
@@ -63,7 +63,7 @@ static int os2_delete(DIR *d)
 	off_t offsets[READDIR_SIZE];
 	int i, j;
 	struct dirent *de;
-	char names[READDIR_SIZE][30];
+	char names[READDIR_SIZE][256];
 
 	/* scan, remembering offsets */
 	for (i=0, de=readdir(d); 
diff --git a/lib/replace/wscript b/lib/replace/wscript
index ea0d5d0..80e8257 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -706,7 +706,8 @@ def build(bld):
     bld.SAMBA_SUBSYSTEM('replace-test',
                       source='''test/testsuite.c test/strptime.c
                       test/os2_delete.c test/getifaddrs.c''',
-                      deps='replace')
+                      deps='replace',
+                      cflags="-Wno-format-zero-length -Wno-format-truncation")
 
     if bld.env.standalone_replace:
         bld.SAMBA_BINARY('replace_testsuite',
diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h
index f9e6dd9..bd80a30 100644
--- a/source3/include/ntioctl.h
+++ b/source3/include/ntioctl.h
@@ -30,7 +30,7 @@
 
 
 /* For FSCTL_GET_SHADOW_COPY_DATA ...*/
-typedef char SHADOW_COPY_LABEL[25];
+typedef char SHADOW_COPY_LABEL[25]; /* sizeof("@GMT-2004.02.18-15.44.00") + 1 */
 
 struct shadow_copy_data {
 	/* Total number of shadow volumes currently mounted */
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index 9b43e85..dae70f5 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -252,6 +252,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
 	while (True) {
 		SHADOW_COPY_LABEL *tlabels;
 		struct dirent *d;
+		int ret;
 
 		d = SMB_VFS_NEXT_READDIR(handle, p, NULL);
 		if (d == NULL) {
@@ -280,7 +281,15 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
 			return -1;
 		}
 
-		snprintf(tlabels[shadow_copy_data->num_volumes++], sizeof(*tlabels), "%s",d->d_name);
+		ret = strlcpy(tlabels[shadow_copy_data->num_volumes], d->d_name,
+			      sizeof(tlabels[shadow_copy_data->num_volumes]));
+		if (ret != sizeof(tlabels[shadow_copy_data->num_volumes]) - 1) {
+			DEBUG(0,("shadow_copy_get_shadow_copy_data: malformed label %s\n",
+				 d->d_name));
+			SMB_VFS_NEXT_CLOSEDIR(handle, p);
+			return -1;
+		}
+		shadow_copy_data->num_volumes++;
 
 		shadow_copy_data->labels = tlabels;
 	}
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index b96c6da..50a18fe 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -157,7 +157,7 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
 		*long_name = strlower_talloc(mem_ctx, last_hit.long_name);
 	}
 
-	if (*short_name == '\0') {
+	if (*short_name[0] == '\0') {
 		*short_name = talloc_strdup(mem_ctx, *long_name);
 	}
 }
diff --git a/source4/torture/ndr/string.c b/source4/torture/ndr/string.c
index b682555..a53acaa 100644
--- a/source4/torture/ndr/string.c
+++ b/source4/torture/ndr/string.c
@@ -4,18 +4,18 @@
 #include "../lib/util/dlinklist.h"
 #include "param/param.h"
 
-static const char const *ascii = "ascii";
+static const char *ascii = "ascii";
 /* the following is equivalent to "kamelåså öäüÿéèóò" in latin1 */
-static const char const latin1[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xe5, 0x73,
-                                     0xe5, 0x20, 0xF6, 0xE4, 0xFC, 0xFF, 0xE9,
-                                     0xE8, 0xF3, 0xF2, 0x00 };
+static const char latin1[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xe5, 0x73,
+			       0xe5, 0x20, 0xF6, 0xE4, 0xFC, 0xFF, 0xE9,
+			       0xE8, 0xF3, 0xF2, 0x00 };
 /* the following is equivalent to "kamelåså ☺☺☺ öäüÿéèóò" in utf8 */
-static const char const utf8[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xc3, 0xa5,
-                                   0x73, 0xc3, 0xa5, 0x20, 0xE2, 0x98, 0xBA,
-                                   0xE2, 0x98, 0xBA, 0xE2, 0x98, 0xBA, 0x20,
-                                   0xc3, 0xb6, 0xc3, 0xa4, 0xc3, 0xbc, 0xc3,
-                                   0xbf, 0xc3, 0xa9, 0xc3, 0xa8, 0xc3, 0xb3,
-                                   0xc3, 0xb2, 0x00 };
+static const char utf8[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xc3, 0xa5,
+			     0x73, 0xc3, 0xa5, 0x20, 0xE2, 0x98, 0xBA,
+			     0xE2, 0x98, 0xBA, 0xE2, 0x98, 0xBA, 0x20,
+			     0xc3, 0xb6, 0xc3, 0xa4, 0xc3, 0xbc, 0xc3,
+			     0xbf, 0xc3, 0xa9, 0xc3, 0xa8, 0xc3, 0xb3,
+			     0xc3, 0xb2, 0x00 };
 
 /* purely for convenience */
 static int fl_ascii_null = LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list