Commit 42e52150 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

- Clean up

- Don't avoid non-existent off-by-one bug, ie. use full buffer size
parent 5e76149b
......@@ -278,7 +278,7 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
{
char line[1024], *psz_ip, *ptr;
if( fgets( line, sizeof( line ) - 1, file ) == NULL )
if( fgets( line, sizeof( line ), file ) == NULL )
{
if( ferror( file ) )
{
......@@ -289,15 +289,12 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
continue;
}
/* fgets() is cool : never overflow, always nul-terminate */
psz_ip = line;
/* skips blanks */
/* skips blanks - cannot overflow given '\0' is not space */
while( isspace( *psz_ip ) )
{
if( *psz_ip == '\n' )
continue;
psz_ip++;
}
ptr = strchr( psz_ip, '\n' );
if( ptr == NULL )
......@@ -306,7 +303,7 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
psz_path);
do
{
fgets( line, sizeof( line ) - 1, file );
fgets( line, sizeof( line ), file );
if( ferror( file ) || feof( file ) )
{
msg_Err( p_acl->p_owner, "Error reading %s : %s\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment