[MPlayer-dev-eng] [PATCH] Add support for directory-wide configuration overrides V4.1

Christian P. Schmidt schmidt at digadd.de
Wed Sep 2 20:09:03 CEST 2009


Reimar Döffinger wrote:
> On Mon, Aug 31, 2009 at 06:02:05PM +0300, Christian P. Schmidt wrote:
>> @@ -931,13 +932,11 @@
>>  {
>>      char *confpath;
>>      char cfg[strlen(file)+10];
>> +    char dircfg[strlen(file)+14];
> 
> Can be moved inside the use_filedir_conf block.

Done, however I personally dislike this way of coding.

>> @@ -952,6 +951,15 @@
>>      else
>>  	name++;
>>  
>> +    if (use_filedir_conf) {
>> +        av_strlcpy(dircfg, cfg, name-cfg+1);
>> +        strcat(dircfg, "mplayer.conf");
> 
> Even if you don't like my approach with a backup variable, I'd consider
> strcpy(dircfg, cfg);
> strcpy(dircfg + (name - cfg), "mplayer.conf");
> clearer.

Done, however I think that the old code is more verbose, as it literally
says "copy cfg up to the (file-)name into dircfg, than append mplayer.conf".

I didn't touch the string size related things because I'm not sure where
the filename actually can come from - if it's from command line it's
unlikely to be that large, from playlists however it might be possible
to put larger filelengths in to exploit something, and for URLs MAX_PATH
might even be too short, even though the whole code section doesn't make
sense with URLs and might not even be called.

Regards,
Christian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dirwide-mplayer-conf.v4.1.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090902/270e33fd/attachment.asc>


More information about the MPlayer-dev-eng mailing list