[Toybox] [PATCH] blkid: more scanf fun.
Rob Landley
rob at landley.net
Sat Sep 25 10:01:24 PDT 2021
On 9/24/21 7:55 PM, enh via Toybox wrote:
> The unbounded %[] here made me look at the kernel, where the size of a
> block device name is limited to 32 bytes (including the NUL), so
> although the 1024 bytes of toybuf was plenty, that meant that the
> 32-byte buffer for "/dev/%s" was too small because the "%s" alone could
> require the entire buffer. Fix that, and simplify the code a bit by only
> using toybuf for the fgets(). I didn't switch to fscanf() because the
> file has two lines of headers, and calling fgets() twice to skip the
> header seemed more awkward than keeping the continue in the loop.
I have a todo item to make "file" check the blkid types somehow. Haven't worked
out a clean way to do it yet (plumbing logically moves to lib/getmountlist.c
except that vanished), but I ran toybox "file" against a vfat image and it
unknowned it, which disappointed me.
Rob
More information about the Toybox
mailing list