From a3f219d1aec5348ddd3137952be79291da8bf8cb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 10 Sep 2015 10:40:32 -0700 Subject: [PATCH 1/2] Fix gcc -f-fsanitize=address error. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11495 Signed-off-by: Jeremy Allison --- source3/libsmb/nmblib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 8feb029..ccd2ac3 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -212,7 +212,6 @@ static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name) name->name[n++] = (c1<<4) | c2; m -= 2; } - name->name[n] = 0; if (n==MAX_NETBIOSNAME_LEN) { /* parse out the name type, its always @@ -224,8 +223,11 @@ static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name) n = 14; while (n && name->name[n]==' ') name->name[n--] = 0; + } else { + name->name[n] = 0; } + /* now the domain parts (if any) */ n = 0; while (ubuf[offset]) { -- 2.6.0.rc0.131.gf624c3d From e79dc90a7da46fa0d6b5dcc4c216454d40cae827 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Sep 2015 14:34:23 -0700 Subject: [PATCH 2/2] Fix gcc -f-fsanitize=address error. Fix overflow issue. Based on a fix from Vittorio BUG: https://bugzilla.samba.org/show_bug.cgi?id=11495 Signed-off-by: Jeremy Allison --- source4/auth/ntlm/auth_sam.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c index 17f3cfc..49932bf 100644 --- a/source4/auth/ntlm/auth_sam.c +++ b/source4/auth/ntlm/auth_sam.c @@ -295,7 +295,7 @@ static NTSTATUS authsam_password_check_and_record(struct auth4_context *auth_con struct samr_Password *lm_history_pwd = NULL; NTTIME pwdLastSet; NTTIME now; - int allowed_period_mins; + uint64_t allowed_period_mins; NTTIME allowed_period; nt_status = samdb_result_passwords_from_history(tmp_ctx, @@ -408,11 +408,12 @@ static NTSTATUS authsam_password_check_and_record(struct auth4_context *auth_con * OldPasswordAllowedPeriod ("old password allowed period") * is specified in minutes. The default is 60. */ - allowed_period_mins = lpcfg_old_password_allowed_period(auth_context->lp_ctx); + allowed_period_mins = (uint64_t) + lpcfg_old_password_allowed_period(auth_context->lp_ctx); /* * NTTIME uses 100ns units */ - allowed_period = allowed_period_mins * 60 * 1000*1000*10; + allowed_period = allowed_period_mins * 60LL * 1000LL*1000LL*10LL; pwdLastSet = samdb_result_nttime(msg, "pwdLastSet", 0); unix_to_nt_time(&now, time(NULL)); -- 2.6.0.rc0.131.gf624c3d