diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-01-17 04:58:45 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-01-17 04:58:45 +0000 |
commit | ec879eacc263043409b584797d1e8c39258ba125 (patch) | |
tree | 7a7775040b27f7fea0f7bd1c8f0ede91c9ce770d /source3/rpc_parse/parse_srv.c | |
parent | ba51d1d888f98e196627486490e8569faeb641c2 (diff) | |
download | samba-ec879eacc263043409b584797d1e8c39258ba125.tar.gz samba-ec879eacc263043409b584797d1e8c39258ba125.tar.bz2 samba-ec879eacc263043409b584797d1e8c39258ba125.zip |
This removes the 3rd argument from init_unistr2(). There were 240
calls to init_unistr2() in the code and every one of them got the 3rd
argument incorrect, so I thought it best just to remove the argument.
The incorrect usage was caused by callers using strlen() to determine
the length of the string. The 3rd argument to init_unistr2() was
supposed to be the character length, not the byte length of the
string, so for non-english this could come out wrong.
I also removed the bogus 'always allocate at least 256 bytes'
hack. There may be some code that relies on this, but if there is then
the code is broken and needs fixing.
(This used to be commit b9eff31b1433c81fbff733e194914a40f25e3bda)
Diffstat (limited to 'source3/rpc_parse/parse_srv.c')
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bfa1a13be9..fb3484d228 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -37,7 +37,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) DEBUG(5,("init_srv_share_info0_str\n")); if(net_name) - init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh0->uni_netname, net_name); } /******************************************************************* @@ -102,9 +102,9 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch DEBUG(5,("init_srv_share_info1_str\n")); if(net_name) - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh1->uni_netname, net_name); if(remark) - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1->uni_remark, remark); } /******************************************************************* @@ -185,13 +185,13 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, DEBUG(5,("init_srv_share_info2_str\n")); if (net_name) - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh2->uni_netname, net_name); if (remark) - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh2->uni_remark, remark); if (path) - init_unistr2(&sh2->uni_path, path, strlen(path)+1); + init_unistr2(&sh2->uni_path, path); if (passwd) - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh2->uni_passwd, passwd); } /******************************************************************* @@ -297,9 +297,9 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, DEBUG(5,("init_srv_share_info501_str\n")); if(net_name) - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh501->uni_netname, net_name); if(remark) - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh501->uni_remark, remark); } /******************************************************************* @@ -447,13 +447,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, DEBUG(5,("init_srv_share_info502_str\n")); if(net_name) - init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh502str->uni_netname, net_name); if(remark) - init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh502str->uni_remark, remark); if(path) - init_unistr2(&sh502str->uni_path, path, strlen(path)+1); + init_unistr2(&sh502str->uni_path, path); if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh502str->uni_passwd, passwd); sh502str->sd = psd; sh502str->reserved = 0; sh502str->sd_size = sd_size; @@ -552,7 +552,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) DEBUG(5,("init_srv_share_info1004_str\n")); if(remark) - init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1004->uni_remark, remark); } /******************************************************************* @@ -659,7 +659,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate DEBUG(5,("init_srv_share_info1007_str\n")); if(alternate_directory_name) - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name); } /******************************************************************* @@ -1473,7 +1473,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *path, const char *passwd) { q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + init_unistr2(&q->uni_srv_name, srvname); q->info.switch_value = q->info_level = 2; q->info.ptr_share_ctr = 1; @@ -1524,8 +1524,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); - init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); + init_unistr2(&del->uni_srv_name, srvname); + init_unistr2(&del->uni_share_name, sharename); } /******************************************************************* @@ -1588,7 +1588,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); - init_unistr2(&ss0->uni_name, name, strlen(name)+1); + init_unistr2(&ss0->uni_name, name); } /******************************************************************* @@ -1702,8 +1702,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char { DEBUG(5,("init_srv_sess_info1_str\n")); - init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, user, strlen(user)+1); + init_unistr2(&ss1->uni_name, name); + init_unistr2(&ss1->uni_user, user); } /******************************************************************* @@ -2074,8 +2074,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c { DEBUG(5,("init_srv_conn_info1_str\n")); - init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); - init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); + init_unistr2(&ss1->uni_usr_name, usr_name); + init_unistr2(&ss1->uni_net_name, net_name); } /******************************************************************* @@ -2364,8 +2364,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const { DEBUG(5,("init_srv_file_info3_str\n")); - init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); - init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); + init_unistr2(&fi3->uni_path_name, path_name); + init_unistr2(&fi3->uni_user_name, user_name); } /******************************************************************* @@ -2627,7 +2627,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_n->uni_srv_name, server); q_n->file_id = file_id; } @@ -3585,6 +3585,6 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_u->uni_srv_name, server); } |