summaryrefslogtreecommitdiffstats
path: root/source/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-08-21 20:03:32 +0000
committerJeremy Allison <jra@samba.org>2006-08-21 20:03:32 +0000
commit40be745af9b0e960875ecae5bb7ac19c0193a33a (patch)
treeebd0ef924ce0c896da29dfc9352157126326b587 /source/nmbd
parent13246a1bd37a3aa7f26b72705577cc15ae379109 (diff)
downloadsamba-40be745af9b0e960875ecae5bb7ac19c0193a33a.tar.gz
samba-40be745af9b0e960875ecae5bb7ac19c0193a33a.tar.xz
samba-40be745af9b0e960875ecae5bb7ac19c0193a33a.zip
r17668: Fix the miscalculations in pushing announces. Fixes
problems Kukks reported. Jeremy.
Diffstat (limited to 'source/nmbd')
-rw-r--r--source/nmbd/nmbd_sendannounce.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/nmbd/nmbd_sendannounce.c b/source/nmbd/nmbd_sendannounce.c
index a74dd99196f..7fcedc557ee 100644
--- a/source/nmbd/nmbd_sendannounce.c
+++ b/source/nmbd/nmbd_sendannounce.c
@@ -35,7 +35,7 @@ extern BOOL found_lm_clients;
void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip)
{
- pstring outbuf;
+ char outbuf[PSTRING_LEN];
char *p;
DEBUG(3,("send_browser_reset: sending reset request type %d to %s<%02x> IP %s.\n",
@@ -60,7 +60,7 @@ void send_browser_reset(int reset_type, const char *to_name, int to_type, struct
void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work)
{
- pstring outbuf;
+ char outbuf[PSTRING_LEN];
char *p;
work->needannounce = True;
@@ -91,7 +91,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
time_t announce_interval,
const char *server_name, int server_type, const char *server_comment)
{
- pstring outbuf;
+ char outbuf[PSTRING_LEN];
unstring upper_server_name;
char *p;
@@ -116,7 +116,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
SSVAL(p,27,BROWSER_ELECTION_VERSION);
SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */
- p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);
+ p += 31 + push_string(NULL, p+31, server_comment, sizeof(outbuf) - (p + 31 - outbuf), STR_ASCII|STR_TERMINATE);
send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
@@ -132,7 +132,7 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type
time_t announce_interval,
char *server_name, int server_type, char *server_comment)
{
- pstring outbuf;
+ char outbuf[PSTRING_LEN];
char *p=outbuf;
memset(outbuf,'\0',sizeof(outbuf));
@@ -145,7 +145,7 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type
p += 10;
p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
- p += push_string(NULL, p, server_comment, sizeof(pstring)-15, STR_ASCII|STR_UPPER|STR_TERMINATE);
+ p += push_string(NULL, p, server_comment, sizeof(outbuf)- (p - outbuf), STR_ASCII|STR_UPPER|STR_TERMINATE);
send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,