Skip to content
Commit 30d1872d authored by Nikolaus Schulz's avatar Nikolaus Schulz Committed by Linus Torvalds
Browse files

fat: fix buffer overflow in vfat_create_shortname()



When using the string representation of a random counter as part of the base
name, ensure that it is no longer than 4 bytes.

Since we are repeatedly decrementing the counter in a loop until we have found a
unique base name, the counter may wrap around zero; therefore, it is not enough
to mask its higher bits before entering the loop, this must be done inside the
loop.

[hirofumi@mail.parknet.co.jp: use snprintf()]
Signed-off-by: default avatarNikolaus Schulz <microschulz@web.de>
Cc: stable@kernel.org
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2eaa9cfd
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment