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

Minor bugfix and cleanup

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