[MPlayer-dev-eng] [patch 2/5] Dont hardcode filename length

Erik Auerswald auerswal at unix-ag.uni-kl.de
Wed Jan 5 11:43:51 CET 2011


Hi,

On Tue, Jan 04, 2011 at 09:35:03PM +0100, Tobias Diedrich wrote:
> Use limits.h to get the maximum length instead of hardcoding it.
> 
> -     fname=malloc( 255 );
> -     while ( fgets( fname,255,lst_f ) )
> +     fname=malloc(PATH_MAX);
> +     while ( fgets( fname,PATH_MAX,lst_f ) )

FWIW there is no guarantee that PATH_MAX even exists. See e.g.
http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html or
http://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html or
http://bytes.com/topic/c/answers/215365-path_max

I'd thus suggest a configure check for PATH_MAX and providing some
arbitrary fallback value, e.g. 255 as used currently(?).

Erik
-- 
In the beginning, there were not enough colors.
                        -- Guy Keren


More information about the MPlayer-dev-eng mailing list