summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-05 09:36:41 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-05 09:36:41 +0000
commitd5da58df9c75214f2f8166baf0ec99360c69e63f (patch)
tree339501501e6cbc9afa83cadaae7ffa9281bfe490 /source3/nmbd
parentce7f54e953a4f6676c3569dc113e76147e19ef45 (diff)
downloadsamba-d5da58df9c75214f2f8166baf0ec99360c69e63f.tar.gz
samba-d5da58df9c75214f2f8166baf0ec99360c69e63f.tar.bz2
samba-d5da58df9c75214f2f8166baf0ec99360c69e63f.zip
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 762d61b37d053568b6346e249ba7ef594320153a)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_become_lmb.c6
-rw-r--r--source3/nmbd/nmbd_browsesync.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index bac5589566..829496c195 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -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,
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index f27f42297f..84c6f43f57 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -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,