[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Mar 22 00:55:03 UTC 2018


The branch, master has been updated
       via  e0cf35a lib:param: Fix the size type in lp_do_parameter_parametric()
       via  b70bb81 s3:lib: Fix size types in tldap_find_first_star()
       via  e64738b s3:lib: Fix size types in ms_fnmatch()
       via  5e62c1c s3:printing: Fix size check in get_file_version()
      from  80f9ec0 talloc: version 2.1.12

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e0cf35aec23e2fa52a8a2c8b151a81175445efaf
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Mar 21 11:26:55 2018 +0100

    lib:param: Fix the size type in lp_do_parameter_parametric()
    
    This fixes compilation with -Wstrict-overflow=2
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Mar 22 01:54:08 CET 2018 on sn-devel-144

commit b70bb81a191f57612b877564bcf2bae3ecdd1c24
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Mar 21 11:24:45 2018 +0100

    s3:lib: Fix size types in tldap_find_first_star()
    
    This fixes compilation with -Wstrict-overflow=2
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e64738b606c815dc98f4ea289f6cd260f03a1975
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Mar 21 11:19:44 2018 +0100

    s3:lib: Fix size types in ms_fnmatch()
    
    This fixes compilation with -Wstrict-overflow=2
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5e62c1cb36d7fe2336d5cc497c5173f40f00be1d
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 7 18:01:45 2017 +0100

    s3:printing: Fix size check in get_file_version()
    
    This fixes compilation with -Wstrict-overflow=2
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 lib/param/loadparm.c           |  2 +-
 source3/lib/ms_fnmatch.c       |  3 ++-
 source3/lib/tldap.c            |  3 ++-
 source3/printing/nt_printing.c | 24 ++++++++++++++++++------
 4 files changed, 23 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index b46700d..0c1b28b 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -1598,7 +1598,7 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx,
 static bool set_variable_helper(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
 			 const char *pszParmName, const char *pszParmValue)
 {
-	int i;
+	size_t i;
 
 	/* switch on the type of variable it is */
 	switch (parm_table[parmnum].type)
diff --git a/source3/lib/ms_fnmatch.c b/source3/lib/ms_fnmatch.c
index 9763afe..a69407b 100644
--- a/source3/lib/ms_fnmatch.c
+++ b/source3/lib/ms_fnmatch.c
@@ -150,7 +150,8 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
 {
 	smb_ucs2_t *p = NULL;
 	smb_ucs2_t *s = NULL;
-	int ret, count, i;
+	int ret;
+	size_t count, i;
 	struct max_n *max_n = NULL;
 	struct max_n *max_n_free = NULL;
 	struct max_n one_max_n;
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 205a9cf..bfb24ee 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -1262,7 +1262,8 @@ static bool tldap_find_first_star(const char *val, const char **star)
 
 static bool tldap_unescape_inplace(char *value, size_t *val_len)
 {
-	int c, i, p;
+	int c;
+	size_t i, p;
 
 	for (i = 0,p = 0; i < *val_len; i++) {
 
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 2e500f1..241af37 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -485,19 +485,31 @@ static int get_file_version(files_struct *fsp, char *fname,uint32_t *major, uint
 				/* Potential match data crosses buf boundry, move it to beginning
 				 * of buf, and fill the buf with as much as it will hold. */
 				if (i>byte_count-VS_VERSION_INFO_SIZE) {
-					int bc;
+					ssize_t amount_read;
+					ssize_t amount_unused = byte_count-i;
 
-					memcpy(buf, &buf[i], byte_count-i);
-					if ((bc = vfs_read_data(fsp, &buf[byte_count-i], VS_NE_BUF_SIZE-
-								   (byte_count-i))) < 0) {
+					memmove(buf, &buf[i], amount_unused);
+					amount_read = vfs_read_data(fsp,
+						&buf[amount_unused],
+						VS_NE_BUF_SIZE- amount_unused);
+					if (amount_read < 0) {
 
 						DEBUG(0,("get_file_version: NE file [%s] Read error, errno=%d\n",
 								 fname, errno));
 						goto error_exit;
 					}
 
-					byte_count = bc + (byte_count - i);
-					if (byte_count<VS_VERSION_INFO_SIZE) break;
+					if (amount_read + amount_unused <
+							amount_read) {
+						/* Check for integer wrap. */
+						break;
+					}
+
+					byte_count = amount_read +
+						     amount_unused;
+					if (byte_count < VS_VERSION_INFO_SIZE) {
+						break;
+					}
 
 					i = 0;
 				}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list