diff options
author | Andreas Schneider <asn@samba.org> | 2015-01-30 14:29:26 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-02-23 22:32:48 +0100 |
commit | a782ae1da463433b6f5199acd0d093583780dd20 (patch) | |
tree | 8e1c7704943304e5fab8523753f14c0922352c99 /nsswitch | |
parent | a5e3a198d0a1c36a3798935595e4844588caba68 (diff) | |
download | samba-a782ae1da463433b6f5199acd0d093583780dd20.tar.gz |
nss-wins: Do not lookup invalid netbios names
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/wins.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/nsswitch/wins.c b/nsswitch/wins.c index d63968b2bc5..5127ee479f4 100644 --- a/nsswitch/wins.c +++ b/nsswitch/wins.c @@ -59,10 +59,12 @@ static void nss_wins_init(void) static struct in_addr *lookup_byname_backend(const char *name, int *count) { - TALLOC_CTX *frame = talloc_stackframe(); + TALLOC_CTX *frame; struct sockaddr_storage *address = NULL; struct in_addr *ret = NULL; NTSTATUS status; + const char *p; + size_t nbt_len; int j; if (!initialised) { @@ -71,6 +73,16 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) *count = 0; + nbt_len = strlen(name); + if (nbt_len > MAX_NETBIOSNAME_LEN - 1) { + return NULL; + } + p = strchr(name, '.'); + if (p != NULL) { + return NULL; + } + + frame = talloc_stackframe(); /* always try with wins first */ status = resolve_wins(name, 0x00, talloc_tos(), &address, count); |