diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-16 00:10:30 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-16 00:10:30 +0000 |
commit | 96c5a010bb42b268b441f776ac44cad84d5f2261 (patch) | |
tree | a94609294a592ea43ae54a032bd15ff1befd612e /source3 | |
parent | ce0c99312c7da78679357610730ba5b60f4319b9 (diff) | |
download | samba-96c5a010bb42b268b441f776ac44cad84d5f2261.tar.gz samba-96c5a010bb42b268b441f776ac44cad84d5f2261.tar.bz2 samba-96c5a010bb42b268b441f776ac44cad84d5f2261.zip |
Avoid mb conversion overflow when sending an announcement.
Jeremy.
(This used to be commit 188e1daaffb3b21abc250ebb37d9a671ba51d054)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nmbd/nmbd_sendannounce.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c index 6e50d2f2ff..a74dd99196 100644 --- a/source3/nmbd/nmbd_sendannounce.c +++ b/source3/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. */ |