summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-28 18:23:05 +0000
committerJeremy Allison <jra@samba.org>2003-08-28 18:23:05 +0000
commit569c2827fa64d2ab81959b13e552ab675174fa00 (patch)
treed13167e1a3161eb17b59ea73af80846430de4b56 /source3
parent6872f392f1a8cd667aecc8df0b15da66f58c9407 (diff)
downloadsamba-569c2827fa64d2ab81959b13e552ab675174fa00.tar.gz
samba-569c2827fa64d2ab81959b13e552ab675174fa00.tar.bz2
samba-569c2827fa64d2ab81959b13e552ab675174fa00.zip
Add length warning on register name.
Jeremy. (This used to be commit 68d02ebbcd9bc4cf7c84763d03c903b1f2e55fb8)
Diffstat (limited to 'source3')
-rw-r--r--source3/nmbd/nmbd_nameregister.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index 5c9deeb4db..0397f56512 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -471,8 +471,18 @@ void register_name(struct subnet_record *subrec,
struct userdata_struct *userdata)
{
struct nmb_name nmbname;
-
- make_nmb_name(&nmbname, name, type);
+ nstring nname;
+
+ if (strlen(name)+1 > sizeof(nstring)) {
+ memcpy(nname, name,sizeof(nstring)-1);
+ nname[sizeof(nstring)-1] = '\0';
+ DEBUG(0,("register_name: NetBIOS name %s is too long. Truncating to %s\n",
+ name, nname));
+ } else {
+ nstrcpy(nname,name);
+ }
+
+ make_nmb_name(&nmbname, nname, type);
/* Always set the NB_ACTIVE flag on the name we are
registering. Doesn't make sense without it.