[iyonix-support] Re: Buffer Overflow in Repeat processing

On 23 Nov, Jeremy C B Nicoll <Jeremy@xxxxxxxxxxxxxxxx> wrote:
> John Myers reported (in csa.apps) getting get 'message from repeat -
> buffer overflow' under RO 5.11 during boot.  Ian Hamilton replied:
>
> > Too many applications in the top level of a directory which gets
> > scanned during the boot sequence - most likely 'Utilities'.
> > Personally I create directories within 'Utilities' splitting the
> > programs into different categories so there are very few at the top
> > level.
>
> What can be done about the original problem - surely Repeat shouldn't
> run out of space no matter how many files/directories are involved?

This is a known issue which has come up before. It's basically the result of
a change intended for STBs (set-top boxes) making its way into the desktop
version of some code.

For the record, this is what it is all about: because you cannot be sure of
the order a directory will be enumerated in (it's a happy coincidence that
FileCore file systems happen to return objects in alphabetical order) and
because it's critically important that you know the order things happen when
a STB boots from (say) NFS, the Repeat command in the BootCommands module
was given a "-sort" switch.

To implement sorting, a buffer is created to read all of the directory leaf
name strings into and then an array (which is where the actual limit lies)
of pointers to these strings can be sorted. That results (because this was a
"get something working quick!" bit of code) in a limit to the number of
objects which can be in a directory - this was never a problem for STBs
because their boot sequence was under strict control, unlike a desktop
machine where each user messes-about with their boot sequence in new and
interesting ways.

There are a number of possible solutions:

1) switch-out the fixed buffer (and -sort switch) in desktop builds
2) bodge the problem by increasing the size of the pointer array
3) fix the code properly to grow the pointer array and leafname buffer
   during directory enumeration, as required. Or bypass all of that if
   -sort isn't present.

Steve

-- 
Steve @ PlusNet
---
To alter your preferences or leave the group, 
visit http://www.freelists.org/list/iyonix-support
Other info via http://www.freelists.org/webpage/iyonix-support

Other related posts: