1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

selftest: Add test for ndr_size_union() faulting on a NULL pointer

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2019-12-04 16:49:13 +13:00
parent 6ef5014549
commit f56fa3bb6a
2 changed files with 32 additions and 0 deletions

View File

@ -367,3 +367,34 @@ dump OK
self.assertEqual(actual[:len(expected_head)],
expected_head)
self.assertTrue(actual.endswith(expected_tail))
# Test a --validate push of a NULL union pointer
def test_ndrdump_fuzzed_NULL_union_PAC_BUFFER(self):
expected = b'''pull returned Success
WARNING! 13 unread bytes
[0000] F5 FF 00 3C 3C 25 FF 70 16 1F A0 12 84 ...<<%.p .....
PAC_BUFFER: struct PAC_BUFFER
type : UNKNOWN_ENUM_VALUE (1094251328)
_ndr_size : 0x048792c6 (75993798)
info : NULL
_pad : 0x06000000 (100663296)
push returned Success
pull returned Success
PAC_BUFFER: struct PAC_BUFFER
type : UNKNOWN_ENUM_VALUE (1094251328)
_ndr_size : 0x00000000 (0)
info : NULL
_pad : 0x00000000 (0)
WARNING! orig bytes:29 validated pushed bytes:16
WARNING! orig and validated differ at byte 0x04 (4)
WARNING! orig byte[0x04] = 0xC6 validated byte[0x04] = 0x00
dump OK
'''
try:
actual = self.check_output(
"ndrdump krb5pac PAC_BUFFER struct --validate --input " +\
"QPM4QcaShwQAAAAAAAAABvX/ADw8Jf9wFh+gEoQ= --base64-input")
except BlackboxProcessError as e:
self.fail(e)
self.assertEqual(actual, expected)

View File

@ -0,0 +1 @@
^samba.tests.blackbox.ndrdump.samba.tests.blackbox.ndrdump.NdrDumpTests.test_ndrdump_fuzzed_NULL_union_PAC_BUFFER