]> git.ipfire.org Git - thirdparty/samba.git/commit
s3: lib: nmbname: Ensure we limit the NetBIOS name correctly. CID: 1433607
authorJeremy Allison <jra@samba.org>
Mon, 12 Nov 2018 19:37:31 +0000 (11:37 -0800)
committerKarolin Seeger <kseeger@samba.org>
Fri, 1 Feb 2019 10:32:46 +0000 (11:32 +0100)
commit8932a4a161f2647057e1fe815562354e0a12ccbd
tree25b93d886999926cbe751d227f5dd5b82d48eddd
parent129423d36572edf48a6931a0e5dab4a8e1acc05e
s3: lib: nmbname: Ensure we limit the NetBIOS name correctly. CID: 1433607

Firstly, make the exit condition from the loop explicit (we must
never write into byte n, where n >= sizeof(name->name).

Secondly ensure exiting from the loop that n==MAX_NETBIOSNAME_LEN,
as this is the sign of a correct NetBIOS name encoding (RFC1002)
in order to properly read the NetBIOS name type (which is always
encoded in byte 16 == name->name[15]).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11495

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Nov 13 20:54:56 CET 2018 on sn-devel-144

(cherry picked from commit 3634e20c7603103b0f2e00e5b61cc63f905d780d)
source3/libsmb/nmblib.c