[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Oct 19 18:39:25 MDT 2009


The branch, master has been updated
       via  f49818e... lib-util: check for too many combinations in generate_unique_strs()
      from  5dcf006... tdb: fixed the intermittent failure of tdbtorture in the build farm

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


- Log -----------------------------------------------------------------
commit f49818e422b550b5080601e640e6ee5d49c80a81
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Oct 20 11:34:49 2009 +1100

    lib-util: check for too many combinations in generate_unique_strs()

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

Summary of changes:
 lib/util/genrand.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/genrand.c b/lib/util/genrand.c
index 6002c06..f054402 100644
--- a/lib/util/genrand.c
+++ b/lib/util/genrand.c
@@ -375,7 +375,6 @@ _PUBLIC_ char** generate_unique_strs(TALLOC_CTX *mem_ctx, size_t len,
 	const unsigned c_size = 42;
 	int i, j;
 	unsigned rem;
-	long long place;
 	char ** strs = NULL;
 
 	if (num == 0 || len == 0)
@@ -397,6 +396,16 @@ _PUBLIC_ char** generate_unique_strs(TALLOC_CTX *mem_ctx, size_t len,
 		}
 		retstr[j] = 0;
 		strs[i] = retstr;
+		if (rem != 0) {
+			/* we were not able to fit the number of
+			 * combinations asked for in the length
+			 * specified */
+			DEBUG(0,(__location__ ": Too many combinations %u for length %u\n",
+				 num, (unsigned)len));
+				 
+			talloc_free(strs);
+			return NULL;			 
+		}
 	}
 
 	return strs;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list