From 2737f26ad64ee32d6ef7365dcce0a3eb881f99db Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 15 Feb 1999 05:33:30 +0000 Subject: Always null-terminate strings. Also some string length and sizeof(pointer) corrections. (This used to be commit ce24191939b82985d09eabe945199f38b0fea486) --- source3/rpc_server/srv_lsa.c | 4 ++-- source3/rpc_server/srv_netlog.c | 6 +++--- source3/rpc_server/srv_pipe.c | 6 +++--- source3/rpc_server/srv_reg.c | 2 +- source3/rpc_server/srv_samr.c | 12 ++++++------ source3/rpc_server/srv_svcctl.c | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index fbbeb4233e..45ddefe592 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -156,7 +156,7 @@ static int make_dom_ref(DOM_R_REF *ref, char *dom_name, DOM_SID *dom_sid) for (num = 0; num < ref->num_ref_doms_1; num++) { fstring domname; - unistr2_to_ascii(domname, &ref->ref_dom[num].uni_dom_name, sizeof(domname)); + unistr2_to_ascii(domname, &ref->ref_dom[num].uni_dom_name, sizeof(domname)-1); if (strequal(domname, dom_name)) { return num; @@ -217,7 +217,7 @@ static void make_lsa_rid2s(DOM_R_REF *ref, char *dom_name = NULL; uint8 sid_name_use = SID_NAME_UNKNOWN; - unistr2_to_ascii(find_name, &name[i], sizeof(find_name)); + unistr2_to_ascii(find_name, &name[i], sizeof(find_name)-1); dom_name = strdup(find_name); if (map_domain_name_to_sid(&sid, &dom_name)) diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index f34aa502ed..30c132aa06 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -288,7 +288,7 @@ static void api_net_req_chal( uint16 vuid, /* grab the challenge... */ net_io_q_req_chal("", &q_r, data, 0); - unistr2_to_ascii(mach_acct, &q_r.uni_logon_clnt, sizeof(mach_acct)); + unistr2_to_ascii(mach_acct, &q_r.uni_logon_clnt, sizeof(mach_acct)-1); fstrcpy(mach_name, mach_acct); strlower(mach_name); @@ -400,7 +400,7 @@ static void api_net_srv_pwset( uint16 vuid, DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__)); unistr2_to_ascii(mach_acct, &q_a.clnt_id.login.uni_acct_name, - sizeof(mach_acct)); + sizeof(mach_acct)-1); DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct)); @@ -674,7 +674,7 @@ static void api_net_sam_logon( uint16 vuid, if (status == 0) { unistr2_to_ascii(nt_username, uni_samlogon_user, - sizeof(nt_username)); + sizeof(nt_username)-1); DEBUG(3,("User:[%s]\n", nt_username)); diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 07e16c7e5d..e619797f6e 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -227,13 +227,13 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) { unibuf_to_ascii(p->user_name, p->ntlmssp_resp.user, MIN(p->ntlmssp_resp.hdr_usr .str_str_len/2, - sizeof(p->user_name))); + sizeof(p->user_name)-1)); unibuf_to_ascii(p->domain , p->ntlmssp_resp.domain, MIN(p->ntlmssp_resp.hdr_domain.str_str_len/2, - sizeof(p->domain ))); + sizeof(p->domain )-1)); unibuf_to_ascii(p->wks , p->ntlmssp_resp.wks, MIN(p->ntlmssp_resp.hdr_wks .str_str_len/2, - sizeof(p->wks ))); + sizeof(p->wks )-1)); } else { diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index 52fff8716c..47ead00227 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -136,7 +136,7 @@ static void reg_reply_open_entry(REG_Q_OPEN_ENTRY *q_u, status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */ } - unistr2_to_ascii(name, &q_u->uni_name, sizeof(name)); + unistr2_to_ascii(name, &q_u->uni_name, sizeof(name)-1); if (status == 0x0) { diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 7f2b62212e..449a47e4c9 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -1440,7 +1440,7 @@ static void samr_reply_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, { DOM_SID sid; fstring name; - unistr2_to_ascii(name, &q_u->uni_name[i], sizeof(name)); + unistr2_to_ascii(name, &q_u->uni_name[i], sizeof(name)-1); status = lookup_name(name, &sid, &(type[i])); if (status == 0x0) @@ -1489,8 +1489,8 @@ static void samr_reply_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, fstring user_name; fstring wks; - unistr2_to_ascii(user_name, &q_u->uni_user_name, sizeof(user_name)); - unistr2_to_ascii(wks, &q_u->uni_dest_host, sizeof(wks)); + unistr2_to_ascii(user_name, &q_u->uni_user_name, sizeof(user_name)-1); + unistr2_to_ascii(wks, &q_u->uni_dest_host, sizeof(wks)-1); DEBUG(5,("samr_chgpasswd_user: user: %s wks: %s\n", user_name, wks)); @@ -2024,7 +2024,7 @@ static void samr_reply_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, if (status == 0x0) { - unistr2_to_ascii(grp.name, &q_u->uni_acct_desc, sizeof(grp.name)); + unistr2_to_ascii(grp.name, &q_u->uni_acct_desc, sizeof(grp.name)-1); fstrcpy(grp.comment, ""); grp.rid = 0xffffffff; @@ -2135,7 +2135,7 @@ static void samr_reply_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_u, if (status == 0x0) { - unistr2_to_ascii(grp.name, &q_u->uni_acct_desc, sizeof(grp.name)); + unistr2_to_ascii(grp.name, &q_u->uni_acct_desc, sizeof(grp.name)-1); fstrcpy(grp.comment, ""); grp.rid = 0xffffffff; grp.attr = 0x07; @@ -2302,7 +2302,7 @@ static void api_samr_unknown_32( uint16 vuid, prs_struct *data, prs_struct *rdat reply if the account already exists... */ - unistr2_to_ascii(mach_acct, &q_u.uni_mach_acct, sizeof(mach_acct)); + unistr2_to_ascii(mach_acct, &q_u.uni_mach_acct, sizeof(mach_acct)-1); become_root(True); sam_pass = getsam21pwntnam(mach_acct); diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index cf6ab5a0e1..56a0749776 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -93,7 +93,7 @@ static void svc_reply_open_service(SVC_Q_OPEN_SERVICE *q_u, status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */ } - unistr2_to_ascii(name, &q_u->uni_svc_name, sizeof(name)); + unistr2_to_ascii(name, &q_u->uni_svc_name, sizeof(name)-1); if (status == 0x0) { @@ -143,7 +143,7 @@ static void svc_reply_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */ } - unistr2_to_ascii(name, &q_u->uni_srv_name, sizeof(name)); + unistr2_to_ascii(name, &q_u->uni_srv_name, sizeof(name)-1); if (status == 0x0) { -- cgit