diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-01-01 19:03:22 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-01-01 19:03:22 +0000 |
commit | 0eb381415da119cb3bcac50116ddc1b4be6bd13d (patch) | |
tree | 167f225226c4f6292f4b43a7cad0fa9240240376 | |
parent | be362405825b2fce55caad56fdbe823ed59c7927 (diff) |
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
-rw-r--r-- | subopt-helper.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/subopt-helper.c b/subopt-helper.c index 7ae5512f3d..df2ceda639 100644 --- a/subopt-helper.c +++ b/subopt-helper.c @@ -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; } |