[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Mar 10 17:24:02 MDT 2015


The branch, master has been updated
       via  006328b tdb: Fix CID 1034842 Resource leak
       via  1b8c07a tdb: Fix CID 1034841 Resource leak
       via  a8c1ad55 lib: Fix CID 1034840 Resource leak
       via  289c097 lib: Fix CID 1034839 Resource leak
       via  bd470af lib: Fix CID 1034838 Resource leak
       via  b3bbc4f smbcontrol: Simplify do_winbind_offline
       via  1f9f400 libreplace: Fix CID 1034926 Destination buffer too small
       via  621bd07 ctdb: Fix 1125553 Buffer not null terminated
       via  f6a75cf registry: Fix CID 240989 Buffer not null terminated
       via  101b047 registry: Fix CID 241075 Unchecked return value
      from  ee087f8 torture4: Fix systems with a 32-bit "long"

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


- Log -----------------------------------------------------------------
commit 006328b81b2dd3416c20b0f19b438c614c1932cc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 8 19:21:23 2015 +0000

    tdb: Fix CID 1034842 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Mar 11 00:23:20 CET 2015 on sn-devel-104

commit 1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 8 19:18:21 2015 +0000

    tdb: Fix CID 1034841 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit a8c1ad55b5c93bcebb5e417eb95b740b5ead0045
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 8 19:12:11 2015 +0000

    lib: Fix CID 1034840 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit 289c0970023adddc1ba8dbbef8921d15a118f9bb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 8 19:10:50 2015 +0000

    lib: Fix CID 1034839 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit bd470af1df70cff1c108ad0f818d8c6bf92a8b6b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 8 19:06:38 2015 +0000

    lib: Fix CID 1034838 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit b3bbc4f6a7e612329efa2bff3456c5eaf8e29d95
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 7 11:39:05 2015 +0000

    smbcontrol: Simplify do_winbind_offline
    
    This saves 128 bytes of .text on x86-64 with -O3. No idea why...
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit 1f9f4006ac9c2a73a8fac7f00ab755f8dcddaf3b
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 7 11:24:33 2015 +0000

    libreplace: Fix CID 1034926 Destination buffer too small
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit 621bd0784290f24e229caf0590206805f6f2e75c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 7 10:29:21 2015 +0000

    ctdb: Fix 1125553 Buffer not null terminated
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit f6a75cf4d18621e05206368b6811057450f65d75
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 7 10:24:18 2015 +0000

    registry: Fix CID 240989 Buffer not null terminated
    
    This makes it clearer that we don't really have a string in .hdr
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit 101b047ab098444aec126d56d2dabc8d4c2c049c
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 6 11:02:49 2015 +0000

    registry: Fix CID 241075 Unchecked return value
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

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

Summary of changes:
 ctdb/common/system_linux.c                 |  2 +-
 lib/replace/test/os2_delete.c              |  3 ++-
 lib/replace/test/testsuite.c               | 13 +++++++++++++
 lib/tdb/test/run-incompatible.c            |  8 +++++---
 lib/tdb/test/run-open-during-transaction.c |  1 +
 source3/utils/smbcontrol.c                 |  6 +-----
 source4/lib/registry/ldb.c                 |  3 ++-
 source4/lib/registry/patchfile_preg.c      |  2 +-
 8 files changed, 26 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c
index 97a57ac..fdb8d12 100644
--- a/ctdb/common/system_linux.c
+++ b/ctdb/common/system_linux.c
@@ -100,7 +100,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
 		}
 
 		DEBUG(DEBUG_DEBUG, (__location__ " Created SOCKET FD:%d for sending arp\n", s));
-		strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1);
+		strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
 		if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
 			DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
 			close(s);
diff --git a/lib/replace/test/os2_delete.c b/lib/replace/test/os2_delete.c
index 9e2115b..0816f61 100644
--- a/lib/replace/test/os2_delete.c
+++ b/lib/replace/test/os2_delete.c
@@ -70,7 +70,8 @@ static int os2_delete(DIR *d)
 	     de && i < READDIR_SIZE; 
 	     de=readdir(d), i++) {
 		offsets[i] = telldir(d);
-		strcpy(names[i], de->d_name);
+		/* strlcpy not available here */
+		snprintf(names[i], sizeof(names[i]), "%s", de->d_name);
 	}
 
 	if (i == 0) {
diff --git a/lib/replace/test/testsuite.c b/lib/replace/test/testsuite.c
index 52629ec..017b8ed 100644
--- a/lib/replace/test/testsuite.c
+++ b/lib/replace/test/testsuite.c
@@ -272,6 +272,7 @@ static int test_strndup(void)
 	x = strndup("bla", 10);
 	if (strcmp(x, "bla") != 0) {
 		printf("failure: strndup [\ninvalid\n]\n");
+		free(x);
 		return false;
 	}
 	free(x);
@@ -887,6 +888,7 @@ static int test_utime(void)
 		printf("failure: utime [\n"
 		       "fstat (1) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -896,6 +898,7 @@ static int test_utime(void)
 		printf("failure: utime [\n"
 		       "utime(&u) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -903,6 +906,7 @@ static int test_utime(void)
 		printf("failure: utime [\n"
 		       "fstat (2) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -910,6 +914,7 @@ static int test_utime(void)
 		printf("failure: utime [\n"
 		       "utime(NULL) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -917,6 +922,7 @@ static int test_utime(void)
 		printf("failure: utime [\n"
 		       "fstat (3) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -926,6 +932,7 @@ static int test_utime(void)
 		       "%s: %s(%d) %s %s(%d)\n]\n", \
 		       __location__, \
 		       #a, (int)a, #c, #b, (int)b); \
+		close(fd); \
 		return false; \
 	} \
 } while(0)
@@ -945,6 +952,7 @@ static int test_utime(void)
 
 	unlink(TESTFILE);
 	printf("success: utime\n");
+	close(fd);
 	return true;
 }
 
@@ -969,6 +977,7 @@ static int test_utimes(void)
 		printf("failure: utimes [\n"
 		       "fstat (1) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -979,6 +988,7 @@ static int test_utimes(void)
 		printf("failure: utimes [\n"
 		       "utimes(tv) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -986,6 +996,7 @@ static int test_utimes(void)
 		printf("failure: utimes [\n"
 		       "fstat (2) failed - %s\n]\n",
 		       strerror(errno));
+		close(fd);
 		return false;
 	}
 
@@ -995,6 +1006,7 @@ static int test_utimes(void)
 		       "%s: %s(%d) != %s(%d)\n]\n", \
 		       __location__, \
 		       #a, (int)a, #b, (int)b); \
+		close(fd); \
 		return false; \
 	} \
 } while(0)
@@ -1006,6 +1018,7 @@ static int test_utimes(void)
 
 	unlink(TESTFILE);
 	printf("success: utimes\n");
+	close(fd);
 	return true;
 }
 
diff --git a/lib/tdb/test/run-incompatible.c b/lib/tdb/test/run-incompatible.c
index b8e95b5..5f1b586 100644
--- a/lib/tdb/test/run-incompatible.c
+++ b/lib/tdb/test/run-incompatible.c
@@ -28,15 +28,17 @@ static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const ch
 static unsigned int hdr_rwlocks(const char *fname)
 {
 	struct tdb_header hdr;
+	ssize_t nread;
 
 	int fd = open(fname, O_RDONLY);
 	if (fd == -1)
 		return -1;
 
-	if (read(fd, &hdr, sizeof(hdr)) != sizeof(hdr))
-		return -1;
-
+	nread = read(fd, &hdr, sizeof(hdr));
 	close(fd);
+	if (nread != sizeof(hdr)) {
+		return -1;
+	}
 	return hdr.rwlocks;
 }
 
diff --git a/lib/tdb/test/run-open-during-transaction.c b/lib/tdb/test/run-open-during-transaction.c
index 1605376..9a6c6c1 100644
--- a/lib/tdb/test/run-open-during-transaction.c
+++ b/lib/tdb/test/run-open-during-transaction.c
@@ -74,6 +74,7 @@ static void check_file_intact(int fd)
 	if (pread(fd, contents, st.st_size, 0) != st.st_size) {
 		diag("Read fail");
 		errors++;
+		free(contents);
 		return;
 	}
 
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 9af0f3e..3946c08 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -1093,14 +1093,10 @@ static bool do_winbind_offline(struct tevent_context *ev_ctx,
 	   5 times. */
 
 	for (retry = 0; retry < 5; retry++) {
-		TDB_DATA d;
 		uint8 buf[4];
-
-		ZERO_STRUCT(d);
+		TDB_DATA d = { .dptr = buf, .dsize = sizeof(buf) };
 
 		SIVAL(buf, 0, time(NULL));
-		d.dptr = buf;
-		d.dsize = 4;
 
 		tdb_store_bystring(tdb, "WINBINDD_OFFLINE", d, TDB_INSERT);
 
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index d1a8963..1dfffdb 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -650,7 +650,8 @@ static WERROR ldb_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
 		if (ret != LDB_SUCCESS) {
 			return WERR_FOOBAR;
 		}
-		ldb_msg_add_empty(msg, "type", LDB_FLAG_MOD_DELETE, NULL);
+		ret = ldb_msg_add_empty(msg, "type", LDB_FLAG_MOD_DELETE,
+					NULL);
 		if (ret != LDB_SUCCESS) {
 			return WERR_FOOBAR;
 		}
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 28b56dd..8017b58 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -187,7 +187,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
 		data->fd = STDOUT_FILENO;
 	}
 
-	strncpy(preg_header.hdr, "PReg", 4);
+	memcpy(preg_header.hdr, "PReg", sizeof(preg_header.hdr));
 	SIVAL(&preg_header.version, 0, 1);
 	write(data->fd, (uint8_t *)&preg_header, sizeof(preg_header));
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list