fix string argument parsing (e.g. one char strings were not accepted)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14295 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-01-01 19:03:22 +00:00
parent be36240582
commit 0eb381415d
1 changed files with 5 additions and 14 deletions

View File

@ -234,23 +234,14 @@ static char const * parse_str( char const * const str, strarg_t * const valp )
char const * match = strchr( str, ':' );
if ( !match )
{
if ( str[1] != '\0' )
{
int len = strlen( &str[1] );
match = str + 1 + len;
}
else
{
return NULL;
}
}
match = &str[strlen(str)];
// empty string or too long
if ((match == str) || (match - str > 255))
return NULL;
valp->len = match - str;
valp->str = str;
/* if the length is zero, indicate error */
if ( valp->len == 0 ) { return NULL; }
return match;
}