From e7a49f2b25be3d893a516d6cc3c205b58ff0c20c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 21 Aug 2006 20:03:32 +0000 Subject: r17668: Fix the miscalculations in pushing announces. Fixes problems Kukks reported. Jeremy. (This used to be commit 426d722029b245e239f0ee39b6be249c59e1918c) --- source3/nmbd/nmbd_sendannounce.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3') 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, -- cgit