summaryrefslogtreecommitdiffstats
path: root/m_option.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-17 08:15:08 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-17 08:15:08 +0000
commit819307301006fd504c27bac14fc6fbcc0b8ec41e (patch)
treef1e9c090eaea8802c4d8ddda2fc54cb571eb7702 /m_option.c
parentc6e32e91b10e5759cd7353bef8430c0c2bc5cce7 (diff)
downloadmpv-819307301006fd504c27bac14fc6fbcc0b8ec41e.tar.bz2
mpv-819307301006fd504c27bac14fc6fbcc0b8ec41e.tar.xz
Fix crash with e.g. -vf scale=::
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15744 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_option.c')
-rw-r--r--m_option.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/m_option.c b/m_option.c
index a32f39cce6..0609def384 100644
--- a/m_option.c
+++ b/m_option.c
@@ -1261,8 +1261,16 @@ static int get_obj_params(char* opt_name, char* name,char* params,
last_ptr = ptr+1;
}
if(r < 0) return r;
+ if (!last_ptr[0]) // count an empty field at the end, too
+ nold++;
+ if (nold > nopts) {
+ mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Too many options for %s\n", name);
+ return M_OPT_OUT_OF_RANGE;
+ }
if(!_ret) // Just test
return 1;
+ if (n == 0) // No options or only empty options
+ return 1;
ret = malloc((n+2)*2*sizeof(char*));
n = nold = 0;
@@ -1309,6 +1317,8 @@ static int parse_obj_params(m_option_t* opt,char *name,
return r;
if(!dst)
return 1;
+ if (!opts) // no arguments given
+ return 1;
for(r = 0 ; opts[r] ; r += 2)
m_struct_set(desc,dst,opts[r],opts[r+1]);