[MPlayer-cvslog] r22420 - trunk/stream/stream_dvb.c

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Mar 3 14:28:51 CET 2007


Hello,
On Sat, Mar 03, 2007 at 02:10:31PM +0100, nicodvb wrote:
> @@ -764,7 +763,7 @@ dvb_config_t *dvb_get_config(void)
>  	conf->cards = NULL;
>  	for(i=0; i<MAX_CARDS; i++)
>  	{
> -		sprintf(filename, "/dev/dvb/adapter%d/frontend0", i);
> +		snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend0", i);

I simply can't bring myself to see the sense in this from a security
standpoint (disregarding that there is just no issue here).
For the cases snprintf actually catches, we replace a case that has at
least a chance of "just" crashing with a case that is _guaranteed_ to do
something unintended leaving the program continue to run and do this
unintended thing.
If anything, replace this with some other function that aborts if we go
beyond the buffer boundaries. snprintf just is not in any way more safe
than sprintf, it just has other issues, and is likely to increase
complexity - something that always reduces the safety of code.

Greetings,
Reimar Döffinger



More information about the MPlayer-cvslog mailing list