Regression in udf_get_extendedattr()
Jan Kara
reviewerHi!
Quoted 13 lines · Finke Lennart
this is Lennart<https://finke.dev/>, I stumbled on what I think is a missing bounds check in
udf_get_extendedattr(). Found with AI, so take with a grain of salt:I think
127b0d87649f("udf: Avoid confusion of missing and corrupted extended attributes") reintroduced a missing bounds check inudf_get_extendedattr(). Inwhile (offset <
iinfo->i_lenEAttr - sizeof(struct genericFormat)) {
i_lenEAttris a u32 and is only checked against the block size inudf_read_inode()(nothing enforces a minimum), so for 1 <=i_lenEAttr< 12 the subtraction wraps and the guard always holds.
Quoted 5 lines
Maybe something like
while (offset + sizeof(struct genericFormat) <
iinfo->i_lenEAttr) {should do it?
I actually prefer a fix in udf_read_inode() - see the patch I've sent.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR