From 7cc985f3d01dbb27f17231793713caa6565e42ee Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 30 Mar 2014 13:29:56 +0200 Subject: m_property: don't parse empty string as 0 Nice strtol() usage error. --- options/m_property.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'options') diff --git a/options/m_property.c b/options/m_property.c index 4efe68f83d..ff23979ade 100644 --- a/options/m_property.c +++ b/options/m_property.c @@ -576,9 +576,10 @@ int m_property_read_list(int action, void *arg, int count, // This is expected of the form "123" or "123/rest" char *next = strchr(ka->key, '/'); char *end = NULL; + const char *key_end = ka->key + strlen(ka->key); long int item = strtol(ka->key, &end, 10); // not a number, trailing characters, etc. - if (end != ka->key + strlen(ka->key) && end != next) + if ((end != key_end || ka->key == key_end) && end != next) return M_PROPERTY_UNKNOWN; if (item < 0 || item >= count) return M_PROPERTY_UNKNOWN; -- cgit v1.2.3