[MPlayer-dev-eng] Re: [PATCH] fix for unconditional use of PATH_MAX

Robert Millan zeratul2 at wanadoo.es
Tue Apr 29 23:45:27 CEST 2003


On Tue, Apr 29, 2003 at 06:17:34PM +0200, Tobias Diedrich wrote:
> Robert Millan wrote:
> 
> > consider the following call in mplayer.c:
> > 
> > char cwd[PATH_MAX+2]
> > [...]
> > getcwd(cwd, PATH_MAX)
> > 
> > If you hardcode PATH_MAX to, say 512, you'd be declaring a 512-byte
> > buffer and telling getcwd to write the current path to it. If the
> > current path is longer than 512, we're dead. mplayer would crash on
> 
> No, the above code would declare a 514 byte buffer and getcwd would
> write at most 512 bytes because of the size parameter. If it does not
> honor that, than it's a bug of your libc.

eek.. you caught me. actualy getcwd would fail and return ERANGE,
which is still bad. please fix..

-- 
Robert Millan

make: *** No rule to make target `war'.  Stop.

Another world is possible - Just say no to genocide



More information about the MPlayer-dev-eng mailing list