summaryrefslogtreecommitdiff
path: root/source3/utils/nmblookup.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2015-01-30 14:37:06 +0100
committerJeremy Allison <jra@samba.org>2015-02-24 01:01:10 +0100
commit84d4270c8e4ec18e9f83722d6df1a07f70acaade (patch)
treedf746b64b7d84795bd7a445ccd8d1013fc9df814 /source3/utils/nmblookup.c
parenta782ae1da463433b6f5199acd0d093583780dd20 (diff)
downloadsamba-84d4270c8e4ec18e9f83722d6df1a07f70acaade.tar.gz
nmblookup: Warn user if netbios name is too long.
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 24 01:01:10 CET 2015 on sn-devel-104
Diffstat (limited to 'source3/utils/nmblookup.c')
-rw-r--r--source3/utils/nmblookup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 78548e9d68c..a119b3eabe8 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -320,6 +320,7 @@ int main(int argc, const char *argv[])
while(poptPeekArg(pc)) {
char *p;
struct in_addr ip;
+ size_t nbt_len;
fstrcpy(lookup,poptGetArg(pc));
@@ -349,6 +350,14 @@ int main(int argc, const char *argv[])
sscanf(++p,"%x",&lookup_type);
}
+ nbt_len = strlen(lookup);
+ if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
+ d_printf("The specified netbios name [%s] is too long!\n",
+ lookup);
+ continue;
+ }
+
+
if (!query_one(lookup, lookup_type)) {
rc = 1;
d_printf( "name_query failed to find name %s", lookup );