summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-05-07 19:26:12 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-07 19:44:58 +0300
commitdaafc5a368266dc2206b7da0c107b98e0ca042d6 (patch)
treeacd9c120329b97ac4f764319251374a6fc17229d
parentb68f9fef32971095836ea6bbeb2f12af417120d2 (diff)
downloadmpv-daafc5a368266dc2206b7da0c107b98e0ca042d6.tar.bz2
mpv-daafc5a368266dc2206b7da0c107b98e0ca042d6.tar.xz
options: fix -profile parsing after 2db33ab48c
Commit 2db33ab48cfa785 ("options: support string list separators other than ','") started using the "priv" field in options of string list type to store the separator character. However, the "profile" option has a custom type which uses the same parsing function but uses the "priv" field for another purpose. As a result "-profile" parsing used a "random" character as the separator instead of ','; at least uses which depended on ',' working were likely to fail, and if the separator used happened to be a character occurring in the profile name then any use of -profile could break. Fix by adding a check in the parsing function to only read the priv field if the option type is normal string list.
-rw-r--r--m_option.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/m_option.c b/m_option.c
index c388bc0929..927b93cd69 100644
--- a/m_option.c
+++ b/m_option.c
@@ -682,7 +682,9 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa
if (param == NULL || strlen(param) == 0)
return M_OPT_MISSING_PARAM;
- char separator = opt->priv ? *(char *)opt->priv : OPTION_LIST_SEPARATOR;
+ // custom type for "profile" calls this but uses ->priv for something else
+ char separator = opt->type == &m_option_type_string_list && opt->priv ?
+ *(char *)opt->priv : OPTION_LIST_SEPARATOR;
while(ptr[0] != '\0') {
ptr = get_nextsep(ptr, separator, 0);
if(!ptr) {