show_dir crashes on more than 200 columns

Jindrich Novy jnovy at redhat.com
Wed Nov 3 14:55:45 UTC 2004


Hello Leonard, Pavel,

On Wed, 2004-11-03 at 12:50, Pavel Tsekov wrote:
> Hello,
> 
> On Wed, 3 Nov 2004, Leonard den Ottolander wrote:
> 
> > A small fix to avoid a crash in show_dir() with a panel of more than 200
> > columns. Thanks to Vladimir.
> >
> > (Jindrich, a g_malloc0 and a free of tmp[] seem rather redundant here.)
> 
> No, it is not. You cannot rely on MC_MAXPATHLEN - it can be too small or
> too big. For exmaple on Cygwin it is set to 259 . I remeber I've seen
> also pretty big values for MAXPATHLEN which are not suitable for
> allocating on the stack. Use the `widget.cols' and allocate memory from
> the heap.

The widget.cols is IMHO the best solution since we're not wasting any
memory. Corrected patch attached.

greetings,
Jindrich

-- 
Jindrich Novy <jnovy at redhat.com>, http://people.redhat.com/jnovy/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc-CVS-20041103-show_dir.patch
Type: text/x-patch
Size: 848 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20041103/d9d551fa/attachment.bin>


More information about the mc-devel mailing list