Commit a0ed366e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Minor bugfix and cleanup

parent 3ed2da31
...@@ -80,32 +80,22 @@ static int Open( vlc_object_t *p_this ) ...@@ -80,32 +80,22 @@ static int Open( vlc_object_t *p_this )
char *psz_parser = psz_dup; char *psz_parser = psz_dup;
/* Parse server:port */ /* Parse server:port */
while( *psz_parser && *psz_parser != ':' ) if( *psz_parser == '[' )
{ {
if( *psz_parser == '[' ) psz_parser = strchr( psz_parser, ']' );
{ if( psz_parser == NULL )
/* IPV6 */ psz_parser = psz_dup;
while( *psz_parser && *psz_parser != ']' )
{
psz_parser++;
}
}
psz_parser++;
} }
if( *psz_parser != ':' || psz_parser == psz_dup ) psz_parser = strchr( psz_parser, ':' );
if( psz_parser == NULL )
{ {
msg_Err( p_access, "you have to provide server:port addresse" ); msg_Err( p_access, "missing port number : %s", psz_dup );
free( psz_dup ); free( psz_dup );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
*psz_parser++ = '\0';
if( atoi( psz_parser ) <= 0 ) *psz_parser++ = '\0';
{
msg_Err( p_access, "invalid port number (%d)", atoi( psz_parser ) );
free( psz_dup );
return VLC_EGENERIC;
}
/* Init p_access */ /* Init p_access */
p_access->pf_read = Read; p_access->pf_read = Read;
......
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