summaryrefslogtreecommitdiffstats
path: root/source/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-16 00:10:30 +0000
committerJeremy Allison <jra@samba.org>2004-03-16 00:10:30 +0000
commit188e1daaffb3b21abc250ebb37d9a671ba51d054 (patch)
treeb32b9bc20d52cb76329e67e34de6232a39d80128 /source/nmbd
parent834d816caf9cd6318da00febde50d9233469dac2 (diff)
downloadsamba-188e1daaffb3b21abc250ebb37d9a671ba51d054.tar.gz
samba-188e1daaffb3b21abc250ebb37d9a671ba51d054.tar.xz
samba-188e1daaffb3b21abc250ebb37d9a671ba51d054.zip
Avoid mb conversion overflow when sending an announcement.
Jeremy.
Diffstat (limited to 'source/nmbd')
-rw-r--r--source/nmbd/nmbd_sendannounce.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/nmbd/nmbd_sendannounce.c b/source/nmbd/nmbd_sendannounce.c
index 6e50d2f2ff4..a74dd99196f 100644
--- a/source/nmbd/nmbd_sendannounce.c
+++ b/source/nmbd/nmbd_sendannounce.c
@@ -92,6 +92,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
const char *server_name, int server_type, const char *server_comment)
{
pstring outbuf;
+ unstring upper_server_name;
char *p;
memset(outbuf,'\0',sizeof(outbuf));
@@ -103,7 +104,9 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
SCVAL(p,0,updatecount);
SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */
- push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
+ safe_strcpy(upper_server_name, server_name, sizeof(upper_server_name)-1);
+ strupper_m(upper_server_name);
+ push_string(NULL, p+5, upper_server_name, 16, STR_ASCII|STR_TERMINATE);
SCVAL(p,21,lp_major_announce_version()); /* Major version. */
SCVAL(p,22,lp_minor_announce_version()); /* Minor version. */