Skip to contentSkip to conversation

Regression in udf_get_extendedattr()

DISCUSSION Jan Kara 1 participant 1 message Oct 23 1 message not in the archive VFS

lore
Share & tools
lore

Jan Kara

author reviewer
#1 lore raw
In reply to a message not in the archive

Hi!

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 in udf_get_extendedattr(). In

while (offset <

      iinfo->i_lenEAttr - sizeof(struct genericFormat)) {

i_lenEAttr is a u32 and is only checked against the block size in udf_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