From 943aac2e366b781136cfff467b7ea5631890ebdd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Feb 2011 16:47:23 +0100 Subject: s3: Add "len" to pdb_set_hours --- source3/passdb/pdb_get_set.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/passdb/pdb_get_set.c') diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index 07a63e24e6..e572c3d94f 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -918,12 +918,17 @@ bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state return pdb_set_init_flags(sampass, PDB_UNKNOWN6, flag); } -bool pdb_set_hours(struct samu *sampass, const uint8 *hours, enum pdb_value_state flag) +bool pdb_set_hours(struct samu *sampass, const uint8 *hours, int hours_len, + enum pdb_value_state flag) { + if (hours_len > sizeof(sampass->hours)) { + return false; + } + if (!hours) { - memset ((char *)sampass->hours, 0, MAX_HOURS_LEN); + memset ((char *)sampass->hours, 0, hours_len); } else { - memcpy (sampass->hours, hours, MAX_HOURS_LEN); + memcpy (sampass->hours, hours, hours_len); } return pdb_set_init_flags(sampass, PDB_HOURS, flag); -- cgit