summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_become_lmb.c23
-rw-r--r--source3/nmbd/nmbd_browsesync.c9
-rw-r--r--source3/nmbd/nmbd_incomingdgrams.c4
3 files changed, 24 insertions, 12 deletions
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index 2d9f2cce55..7bfd558003 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -248,7 +248,6 @@ void unbecome_local_master_browser(struct subnet_record *subrec, struct work_rec
struct name_record *namerec;
struct nmb_name nmbname;
struct userdata_struct *userdata;
- char ud[sizeof(struct userdata_struct) + sizeof(fstring)+1];
/* Sanity check. */
@@ -268,9 +267,11 @@ in workgroup %s on subnet %s\n",
work->mst_state = MST_UNBECOMING_MASTER;
/* Setup the userdata for the MSBROWSE name release. */
- /* Setup the userdata_struct - this is copied so we can use
- a stack variable for this. */
- userdata = (struct userdata_struct *)ud;
+ if((userdata = (struct userdata_struct *)malloc( sizeof(struct userdata_struct) + sizeof(fstring)+1)) == NULL)
+ {
+ DEBUG(0,("unbecome_local_master_browser: malloc fail.\n"));
+ return;
+ }
userdata->copy_fn = NULL;
userdata->free_fn = NULL;
@@ -286,6 +287,8 @@ in workgroup %s on subnet %s\n",
release_msbrowse_name_fail,
userdata);
}
+
+ free((char *)userdata);
}
/****************************************************************************
@@ -481,7 +484,6 @@ void become_local_master_browser(struct subnet_record *subrec, struct work_recor
{
struct server_record *servrec;
struct userdata_struct *userdata;
- char ud[sizeof(struct userdata_struct) + sizeof(fstring)+1];
/* Sanity check. */
if (!lp_local_master())
@@ -516,9 +518,12 @@ in workgroup %s on subnet %s\n",
/* Tell the namelist writer to write out a change. */
subrec->work_changed = True;
- /* Setup the userdata_struct - this is copied so we can use
- a stack variable for this. */
- userdata = (struct userdata_struct *)ud;
+ /* Setup the userdata_struct. */
+ if((userdata = (struct userdata_struct *)malloc(sizeof(struct userdata_struct) + sizeof(fstring)+1)) == NULL)
+ {
+ DEBUG(0,("become_local_master_browser: malloc fail.\n"));
+ return;
+ }
userdata->copy_fn = NULL;
userdata->free_fn = NULL;
@@ -530,6 +535,8 @@ in workgroup %s on subnet %s\n",
become_local_master_stage1,
become_local_master_fail1,
userdata);
+
+ free((char *)userdata);
}
/***************************************************************
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index cc81807de4..e4231e6017 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -379,7 +379,6 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec,
struct work_record *work;
struct nmb_name nmbname;
struct userdata_struct *userdata;
- char ud[sizeof(struct userdata_struct) + sizeof(fstring)+1];
if (!(work = find_workgroup_on_subnet(subrec, q_name->name))) {
DEBUG(0, ("find_domain_master_name_query_success: failed to find \
@@ -412,7 +411,11 @@ workgroup %s\n", q_name->name ));
/* Setup the userdata_struct - this is copied so we can use
a stack variable for this. */
- userdata = (struct userdata_struct *)ud;
+ if((userdata = (struct userdata_struct *)malloc(sizeof(struct userdata_struct) + sizeof(fstring)+1)) == NULL)
+ {
+ DEBUG(0, ("find_domain_master_name_query_success: malloc fail.\n"));
+ return;
+ }
userdata->copy_fn = NULL;
userdata->free_fn = NULL;
@@ -423,6 +426,8 @@ workgroup %s\n", q_name->name ));
domain_master_node_status_success,
domain_master_node_status_fail,
userdata);
+
+ free((char *)userdata);
}
/****************************************************************************
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 2396c847a3..b1de27f181 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -547,7 +547,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
{
char outbuf[1024];
char *p, *countptr, *nameptr;
- int count = 0;
+ unsigned int count = 0;
int len;
struct server_record *servrec;
@@ -582,7 +582,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
if((sizeof(outbuf) - len) < 16)
break;
- if(count >= max_number_requested)
+ if(count >= (unsigned int)max_number_requested)
break;
if(strnequal(servrec->serv.name, myname,15))