]> git.ipfire.org Git - thirdparty/samba.git/commit
libsmb: Avoid undefined behaviour when parsing whoami state
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 3 May 2021 04:16:51 +0000 (16:16 +1200)
committerJeremy Allison <jra@samba.org>
Wed, 19 May 2021 01:32:34 +0000 (01:32 +0000)
commit9d8aeed33d8edf7a5dc96dbe35e4e164e2baeeeb
treef048793c7759042213422a5f1f58283621ea8f83
parentdb5b34c7682e36630908356cf674fddd18d8fa1f
libsmb: Avoid undefined behaviour when parsing whoami state

If num_gids is such that the gids array would overflow the rdata buffer,
'p + 8' could produce a result pointing outside the buffer, and thus
result in undefined behaviour. To avoid this, we check num_gids against
the size of the buffer beforehand.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source3/libsmb/clifsinfo.c