[PATCH 1/1] makedevs: set path size to match linux

Emmanuel Deloget logout at free.fr
Tue Jun 27 00:36:25 UTC 2017


Hello,

On Mon, Jun 26, 2017 at 11:23 PM, Matthew Weber <
matthew.weber at rockwellcollins.com> wrote:

> Baruch,
>
> On Mon, Jun 26, 2017 at 3:55 PM, Baruch Siach <baruch at tkos.co.il> wrote:
> > Hi Jared,
> >
> > On Mon, Jun 26, 2017 at 03:33:09PM -0500, Matt Weber wrote:
> >> From: Jared Bents <jared.bents at rockwellcollins.com>
> >>
> >> Update to increase the pathname limit to the
> >> linux limit of 4096 characters.
> >>
> >> Similar patch:
> >> https://patchwork.openembedded.org/patch/131475/
> >>
> >> Signed-off-by: Jared Bents <jared.bents at rockwellcollins.com>
> >> Signed-off-by: Matt Weber <matthew.weber at rockwellcollins.com>
> >> ---
> >>  miscutils/makedevs.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
> >> index 9e7ca34..0049edb 100644
> >> --- a/miscutils/makedevs.c
> >> +++ b/miscutils/makedevs.c
> >> @@ -208,7 +208,7 @@ int makedevs_main(int argc UNUSED_PARAM, char
> **argv)
> >>               unsigned count = 0;
> >>               unsigned increment = 0;
> >>               unsigned start = 0;
> >> -             char name[41];
> >> +             char name[4096];
> >
> > Why not use PATH_MAX here?
>
> Agree, that would be cleaner.  Will submit v2 after some testing.
>
> That still leaves a hardcoded value in the sscanf  of 4095........
> should I add a comment to the affect we're assuming PATH_MAX is at
> least 4096?  Maybe a check is also needed?
>

​Alternatively you may use the m modifier, when implemented, to
auto-allocate the name pointer. ​This way you don't have to hardcode
anything in the sscanf(), you let the library for the job for you. Later,
you can check the string length.

Such a change would induce an allocation, a free but will also reduce stack
usage.




>
> Matt
>
>
​Best regards,

-- Emmanuel Deloget​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20170627/f51f7c68/attachment.html>


More information about the busybox mailing list