Loading
s4:kdc: fix OOB read in samba_kdc_trust_message2entry()
samba_kdc_trust_message2entry() used password_blob.count (the top-level wire field from trustAuthInOutBlob) as the loop bound when iterating over both current.array[] and previous.array[]. The NDR parser derives current.count and previous.count independently by walking the subcontext, so the top-level count can be larger than the actual arrays. When it is, the loops read past the heap allocation and the process crashes.
Use password_blob.current.count and password_blob.previous.count as the loop bounds instead, matching what samba_kdc_fill_trust_keys() already does with aa->count.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=16280
Signed-off-by: Aldo Ariel Panzardo qwe.aldo@gmail.com