[vlc-devel] commit: Added a utf8_mkstemp implementation. (Laurent Aimar )
Laurent Aimar
fenrir at via.ecp.fr
Tue Nov 18 01:12:05 CET 2008
On Tue, Nov 18, 2008, Rémi Denis-Courmont wrote:
> On Tuesday 18 November 2008 01:10:37 git version control, you wrote:
> > + uint64_t i_rand = mdate();
>
> This is (obviously) predictible pseudo-randomness, not immediately a problem,
> but...
I would have prefer to use a better seed but dunno what to use...
> > + /* */
> > + for( int i = 0; i < 256; i++ )
> > + {
> > + /* Create a pseudo random file name */
> > + for( int j = 0; j < 6; j++ )
> > + {
> > + i_rand = i_rand * UINT64_C(1103515245) + 12345;
> > + psz_rand[j] = digits[((i_rand >> 16) & 0xffff) % i_digits];
> > + }
> > +
> > + /* */
> > + int fd = utf8_open( template, O_CREAT | O_EXCL | O_RDWR, 0600 );
>
> ...we have an insecure file creation here. To avoid depending on O_NOFOLLOW,
> we should probably use mkstemp() on those platform which do have it.
I haven't though about links.
I can use fstat and close it if it is a link. It would probably be safer
for a start.
I am fine using system mkstemp if present but will it will not use
utf8_open. Is it a problem (path are configurable by a user) ?
--
fenrir
More information about the vlc-devel
mailing list