[libdvdnav-devel] [PATCH] sprintf -> strcpy

Petri Hintukainen phintuka at gmail.com
Wed Sep 9 11:23:09 CEST 2015


On ke, 2015-09-09 at 19:57 +1200, Lawrence D'Oliveiro wrote:
> On Wed,  9 Sep 2015 10:11:16 +0300, Petri Hintukainen wrote:
> 
> > -    sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
> > +    strcpy( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
> [etc]
> 
> I would not use either. I would use strncpy instead.

Why ?

Constant string is copied to constant-size buffer. Buffer overflow
checks should be done at compile time, not runtime.




More information about the libdvdnav-devel mailing list