summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-08-21 20:03:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:45 -0500
commite7a49f2b25be3d893a516d6cc3c205b58ff0c20c (patch)
treeb2726c8a0e48054bac243f341bcd5d2a3fae1b00 /source3/nmbd
parent8d0d3a864b93766415f93d3dcabf9f61e6b1ccad (diff)
downloadsamba-e7a49f2b25be3d893a516d6cc3c205b58ff0c20c.tar.gz
samba-e7a49f2b25be3d893a516d6cc3c205b58ff0c20c.tar.bz2
samba-e7a49f2b25be3d893a516d6cc3c205b58ff0c20c.zip
r17668: Fix the miscalculations in pushing announces. Fixes
problems Kukks reported. Jeremy. (This used to be commit 426d722029b245e239f0ee39b6be249c59e1918c)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_sendannounce.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index a74dd99196..7fcedc557e 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/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,