Re: [PATCH] mtd: parsers: tplink_safeloader: prevent out-of-bounds table reads
From: Miquel Raynal
Date: Fri Dec 04 2026 - 16:50:41 EST
On Tue, 01 Dec 2026 22:50:46 +0800, shao.mingyin@xxxxxxxxxx wrote:
> The SafeLoader parser starts scanning the partition table at offset 4.
> The read helper allocates size + 1 bytes and writes a NUL at buf[size],
> but the scan does not check its starting offset against the table length.
>
> If size is less than 4, the first sscanf() starts past the buffer. If
> the last entry is followed directly by the NUL instead of a newline, the
> bytes + 1 step skips the NUL and can put the next sscanf() past the
> buffer. Both cases can cause a KASAN slab-out-of-bounds report in
> vsscanf().
>
> [...]
Applied to mtd/next, thanks!
[1/1] mtd: parsers: tplink_safeloader: prevent out-of-bounds table reads
commit: 4787bba3d129dd491c9887d7b5912e2785bb4dd0
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl