"# http://www.brynosaurus.com/cachedir/\r\n";
char *psz_cachedir;
+ size_t i_len = 0;
FILE *file;
int i, j, i_cache;
module_cache_t **pp_cache;
}
char psz_filename[sizeof(DIR_SEP) + 32 + strlen(psz_cachedir)];
+ i_len = sizeof(DIR_SEP) + 32 + strlen(psz_cachedir);
config_CreateDir( p_this, psz_cachedir );
- sprintf( psz_filename, "%s"DIR_SEP"CACHEDIR.TAG", psz_cachedir );
+ snprintf( psz_filename, i_len, "%s"DIR_SEP"CACHEDIR.TAG", psz_cachedir );
+ psz_filename[i_len-1] = '\0';
file = utf8_fopen( psz_filename, "wb" );
if( file )
{
fclose( file );
}
- sprintf( psz_filename, "%s"DIR_SEP"%s", psz_cachedir, CacheName() );
-
+ memset( psz_filename, 0, i_len );
+ snprintf( psz_filename, i_len, "%s"DIR_SEP"%s", psz_cachedir, CacheName() );
+ psz_filename[i_len-1] = '\0';
msg_Dbg( p_this, "saving plugins cache file %s", psz_filename );
file = utf8_fopen( psz_filename, "wb" );
{
msg_Warn( p_this, "could not open plugins cache file %s for writing",
psz_filename );
- free( psz_filename );
return;
}
fwrite( &i_file_size, sizeof(char), sizeof(i_file_size), file );
fclose( file );
-
- return;
}
void CacheSaveConfig( module_t *p_module, FILE *file )