[Toybox] [PATCH] blkid: more scanf fun.
enh
enh at google.com
Fri Sep 24 17:55:42 PDT 2021
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.
---
toys/other/blkid.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210924/9e7a1361/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-blkid-more-scanf-fun.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210924/9e7a1361/attachment.bin>
More information about the Toybox
mailing list