mirror of
https://github.com/samba-team/samba.git
synced 2024-12-31 17:18:04 +03:00
A couple more fixes for fstrcpy() into a malloced region. In this case it's
all perfectly legit - the region is an fstring in length, but might not
always be, and it is the last peice of code to fail my automated test.
Andrew Bartlett
(This used to be commit 762d61b37d
)
This commit is contained in:
parent
ce7f54e953
commit
d5da58df9c
@ -207,7 +207,7 @@ static void release_1d_name( struct subnet_record *subrec, char *workgroup_name,
|
||||
if((namerec = find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME))!=NULL)
|
||||
{
|
||||
struct userdata_struct *userdata;
|
||||
int size = sizeof(struct userdata_struct) + sizeof(BOOL);
|
||||
size_t size = sizeof(struct userdata_struct) + sizeof(BOOL);
|
||||
|
||||
if((userdata = (struct userdata_struct *)malloc(size)) == NULL)
|
||||
{
|
||||
@ -518,7 +518,7 @@ workgroup %s on subnet %s. Couldn't register name %s.\n",
|
||||
void become_local_master_browser(struct subnet_record *subrec, struct work_record *work)
|
||||
{
|
||||
struct userdata_struct *userdata;
|
||||
int size = sizeof(struct userdata_struct) + sizeof(fstring) + 1;
|
||||
size_t size = sizeof(struct userdata_struct) + sizeof(fstring) + 1;
|
||||
|
||||
/* Sanity check. */
|
||||
if (!lp_local_master())
|
||||
@ -563,7 +563,7 @@ in workgroup %s on subnet %s\n",
|
||||
userdata->copy_fn = NULL;
|
||||
userdata->free_fn = NULL;
|
||||
userdata->userdata_len = strlen(work->work_group)+1;
|
||||
fstrcpy(userdata->data, work->work_group);
|
||||
safe_strcpy(userdata->data, work->work_group, size - sizeof(*userdata) - 1);
|
||||
|
||||
/* Register the special browser group name. */
|
||||
register_name(subrec, MSBROWSE, 0x01, samba_nb_type|NB_GROUP,
|
||||
|
@ -288,7 +288,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec,
|
||||
struct work_record *work;
|
||||
struct nmb_name nmbname;
|
||||
struct userdata_struct *userdata;
|
||||
int size = sizeof(struct userdata_struct) + sizeof(fstring)+1;
|
||||
size_t size = sizeof(struct userdata_struct) + sizeof(fstring)+1;
|
||||
|
||||
if( !(work = find_workgroup_on_subnet(subrec, q_name->name)) )
|
||||
{
|
||||
@ -333,7 +333,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec,
|
||||
userdata->copy_fn = NULL;
|
||||
userdata->free_fn = NULL;
|
||||
userdata->userdata_len = strlen(work->work_group)+1;
|
||||
fstrcpy(userdata->data, work->work_group);
|
||||
safe_strcpy(userdata->data, work->work_group, size - sizeof(*userdata) - 1);
|
||||
|
||||
node_status( subrec, &nmbname, answer_ip,
|
||||
domain_master_node_status_success,
|
||||
|
Loading…
Reference in New Issue
Block a user