From 864ed92954315600ddcef69b21face95c06224a4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 14 Dec 2009 18:43:03 +0100 Subject: s3: Simplify pdb_set_plaintext_passwd by using talloc_zero_array --- source3/passdb/pdb_get_set.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index bea4c3278e..149dde0802 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -1051,7 +1051,7 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext) /* * Ensure we have space for the needed history. */ - uchar *new_history = talloc_array( + uchar *new_history = talloc_zero_array( sampass, uchar, pwHistLen*PW_HISTORY_ENTRY_LEN); if (!new_history) { @@ -1063,10 +1063,7 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext) memcpy(new_history, pwhistory, current_history_len*PW_HISTORY_ENTRY_LEN); } - /* Clearing out any extra space. */ - memset(&new_history[current_history_len*PW_HISTORY_ENTRY_LEN], - '\0', (pwHistLen-current_history_len)*PW_HISTORY_ENTRY_LEN); - /* Finally replace it. */ + pwhistory = new_history; } } -- cgit